| 545 |
dsic.upv.es!jroman |
1 |
/*
|
|
|
2 |
EPS routines related to options that can be set via the command-line
|
|
|
3 |
or procedurally.
|
| 1376 |
slepc |
4 |
|
|
|
5 |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 1672 |
slepc |
6 |
SLEPc - Scalable Library for Eigenvalue Problem Computations
|
| 2116 |
eromero |
7 |
Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain
|
| 1376 |
slepc |
8 |
|
| 1672 |
slepc |
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/>.
|
| 1376 |
slepc |
22 |
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 545 |
dsic.upv.es!jroman |
23 |
*/
|
| 1376 |
slepc |
24 |
|
| 2283 |
jroman |
25 |
#include <private/epsimpl.h> /*I "slepceps.h" I*/
|
| 526 |
dsic.upv.es!antodo |
26 |
|
|
|
27 |
#undef __FUNCT__
|
|
|
28 |
#define __FUNCT__ "EPSSetFromOptions"
|
|
|
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.
|
|
|
33 |
|
|
|
34 |
Collective on EPS
|
|
|
35 |
|
|
|
36 |
Input Parameters:
|
|
|
37 |
. eps - the eigensolver context
|
|
|
38 |
|
|
|
39 |
Notes:
|
|
|
40 |
To see all options, run your program with the -help option.
|
|
|
41 |
|
|
|
42 |
Level: beginner
|
|
|
43 |
@*/
|
|
|
44 |
PetscErrorCode EPSSetFromOptions(EPS eps)
|
|
|
45 |
{
|
| 2419 |
jroman |
46 |
PetscErrorCode ierr;
|
|
|
47 |
char type[256],monfilename[PETSC_MAX_PATH_LEN];
|
|
|
48 |
PetscBool flg,val;
|
|
|
49 |
PetscReal r,nrma,nrmb,array[2];
|
|
|
50 |
PetscScalar s;
|
|
|
51 |
PetscInt i,j,k;
|
|
|
52 |
const char *bal_list[4] = {"none","oneside","twoside","user"};
|
|
|
53 |
PetscViewer monviewer;
|
|
|
54 |
SlepcConvMonitor ctx;
|
| 526 |
dsic.upv.es!antodo |
55 |
|
|
|
56 |
PetscFunctionBegin;
|
| 2213 |
jroman |
57 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2376 |
jroman |
58 |
if (!EPSRegisterAllCalled) { ierr = EPSRegisterAll(PETSC_NULL);CHKERRQ(ierr); }
|
| 1422 |
slepc |
59 |
ierr = PetscOptionsBegin(((PetscObject)eps)->comm,((PetscObject)eps)->prefix,"Eigenproblem Solver (EPS) Options","EPS");CHKERRQ(ierr);
|
|
|
60 |
ierr = PetscOptionsList("-eps_type","Eigenproblem Solver method","EPSSetType",EPSList,(char*)(((PetscObject)eps)->type_name?((PetscObject)eps)->type_name:EPSKRYLOVSCHUR),type,256,&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
61 |
if (flg) {
|
|
|
62 |
ierr = EPSSetType(eps,type);CHKERRQ(ierr);
|
|
|
63 |
}
|
| 2412 |
jroman |
64 |
/*
|
|
|
65 |
Set the type if it was never set.
|
|
|
66 |
*/
|
|
|
67 |
if (!((PetscObject)eps)->type_name) {
|
|
|
68 |
ierr = EPSSetType(eps,EPSKRYLOVSCHUR);CHKERRQ(ierr);
|
|
|
69 |
}
|
| 526 |
dsic.upv.es!antodo |
70 |
|
| 2216 |
jroman |
71 |
ierr = PetscOptionsBoolGroupBegin("-eps_hermitian","hermitian eigenvalue problem","EPSSetProblemType",&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
72 |
if (flg) {ierr = EPSSetProblemType(eps,EPS_HEP);CHKERRQ(ierr);}
|
| 2216 |
jroman |
73 |
ierr = PetscOptionsBoolGroup("-eps_gen_hermitian","generalized hermitian eigenvalue problem","EPSSetProblemType",&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
74 |
if (flg) {ierr = EPSSetProblemType(eps,EPS_GHEP);CHKERRQ(ierr);}
|
| 2216 |
jroman |
75 |
ierr = PetscOptionsBoolGroup("-eps_non_hermitian","non-hermitian eigenvalue problem","EPSSetProblemType",&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
76 |
if (flg) {ierr = EPSSetProblemType(eps,EPS_NHEP);CHKERRQ(ierr);}
|
| 2216 |
jroman |
77 |
ierr = PetscOptionsBoolGroup("-eps_gen_non_hermitian","generalized non-hermitian eigenvalue problem","EPSSetProblemType",&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
78 |
if (flg) {ierr = EPSSetProblemType(eps,EPS_GNHEP);CHKERRQ(ierr);}
|
| 2216 |
jroman |
79 |
ierr = PetscOptionsBoolGroup("-eps_pos_gen_non_hermitian","generalized non-hermitian eigenvalue problem with positive semi-definite B","EPSSetProblemType",&flg);CHKERRQ(ierr);
|
| 1358 |
slepc |
80 |
if (flg) {ierr = EPSSetProblemType(eps,EPS_PGNHEP);CHKERRQ(ierr);}
|
| 2216 |
jroman |
81 |
ierr = PetscOptionsBoolGroupEnd("-eps_gen_indefinite","generalized hermitian-indefinite eigenvalue problem","EPSSetProblemType",&flg);CHKERRQ(ierr);
|
| 1915 |
jroman |
82 |
if (flg) {ierr = EPSSetProblemType(eps,EPS_GHIEP);CHKERRQ(ierr);}
|
| 526 |
dsic.upv.es!antodo |
83 |
|
| 2216 |
jroman |
84 |
ierr = PetscOptionsBoolGroupBegin("-eps_ritz","Rayleigh-Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr);
|
| 1560 |
slepc |
85 |
if (flg) {ierr = EPSSetExtraction(eps,EPS_RITZ);CHKERRQ(ierr);}
|
| 2216 |
jroman |
86 |
ierr = PetscOptionsBoolGroup("-eps_harmonic","harmonic Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr);
|
| 1560 |
slepc |
87 |
if (flg) {ierr = EPSSetExtraction(eps,EPS_HARMONIC);CHKERRQ(ierr);}
|
| 2216 |
jroman |
88 |
ierr = PetscOptionsBoolGroup("-eps_harmonic_relative","relative harmonic Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr);
|
| 1987 |
eromero |
89 |
if (flg) {ierr = EPSSetExtraction(eps,EPS_HARMONIC_RELATIVE);CHKERRQ(ierr);}
|
| 2216 |
jroman |
90 |
ierr = PetscOptionsBoolGroup("-eps_harmonic_right","right harmonic Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr);
|
| 1987 |
eromero |
91 |
if (flg) {ierr = EPSSetExtraction(eps,EPS_HARMONIC_RIGHT);CHKERRQ(ierr);}
|
| 2216 |
jroman |
92 |
ierr = PetscOptionsBoolGroup("-eps_harmonic_largest","largest harmonic Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr);
|
| 1987 |
eromero |
93 |
if (flg) {ierr = EPSSetExtraction(eps,EPS_HARMONIC_LARGEST);CHKERRQ(ierr);}
|
| 2216 |
jroman |
94 |
ierr = PetscOptionsBoolGroup("-eps_refined","refined Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr);
|
| 1560 |
slepc |
95 |
if (flg) {ierr = EPSSetExtraction(eps,EPS_REFINED);CHKERRQ(ierr);}
|
| 2216 |
jroman |
96 |
ierr = PetscOptionsBoolGroupEnd("-eps_refined_harmonic","refined harmonic Ritz extraction","EPSSetExtraction",&flg);CHKERRQ(ierr);
|
| 1560 |
slepc |
97 |
if (flg) {ierr = EPSSetExtraction(eps,EPS_REFINED_HARMONIC);CHKERRQ(ierr);}
|
| 1426 |
slepc |
98 |
|
| 1940 |
jroman |
99 |
if (!eps->balance) eps->balance = EPS_BALANCE_NONE;
|
| 2331 |
jroman |
100 |
ierr = PetscOptionsEList("-eps_balance","Balancing method","EPSSetBalance",bal_list,4,bal_list[eps->balance-EPS_BALANCE_NONE],&i,&flg);CHKERRQ(ierr);
|
| 1940 |
jroman |
101 |
if (flg) { eps->balance = (EPSBalance)(i+EPS_BALANCE_NONE); }
|
| 1799 |
jroman |
102 |
r = j = PETSC_IGNORE;
|
|
|
103 |
ierr = PetscOptionsInt("-eps_balance_its","Number of iterations in balancing","EPSSetBalance",eps->balance_its,&j,PETSC_NULL);CHKERRQ(ierr);
|
|
|
104 |
ierr = PetscOptionsReal("-eps_balance_cutoff","Cutoff value in balancing","EPSSetBalance",eps->balance_cutoff,&r,PETSC_NULL);CHKERRQ(ierr);
|
| 1824 |
antodo |
105 |
ierr = EPSSetBalance(eps,(EPSBalance)PETSC_IGNORE,j,r);CHKERRQ(ierr);
|
| 1799 |
jroman |
106 |
|
| 1282 |
slepc |
107 |
r = i = PETSC_IGNORE;
|
|
|
108 |
ierr = PetscOptionsInt("-eps_max_it","Maximum number of iterations","EPSSetTolerances",eps->max_it,&i,PETSC_NULL);CHKERRQ(ierr);
|
|
|
109 |
ierr = PetscOptionsReal("-eps_tol","Tolerance","EPSSetTolerances",eps->tol,&r,PETSC_NULL);CHKERRQ(ierr);
|
| 1284 |
slepc |
110 |
ierr = EPSSetTolerances(eps,r,i);CHKERRQ(ierr);
|
| 2216 |
jroman |
111 |
ierr = PetscOptionsBoolGroupBegin("-eps_conv_eig","relative error convergence test","EPSSetConvergenceTest",&flg);CHKERRQ(ierr);
|
| 2083 |
eromero |
112 |
if (flg) {ierr = EPSSetConvergenceTest(eps,EPS_CONV_EIG);CHKERRQ(ierr);}
|
| 2216 |
jroman |
113 |
ierr = PetscOptionsBoolGroup("-eps_conv_norm","Convergence test relative to the eigenvalue and the matrix norms","EPSSetConvergenceTest",&flg);CHKERRQ(ierr);
|
| 2083 |
eromero |
114 |
if (flg) {ierr = EPSSetConvergenceTest(eps,EPS_CONV_NORM);CHKERRQ(ierr);}
|
| 2216 |
jroman |
115 |
ierr = PetscOptionsBoolGroupEnd("-eps_conv_abs","Absolute error convergence test","EPSSetConvergenceTest",&flg);CHKERRQ(ierr);
|
| 2083 |
eromero |
116 |
if (flg) {ierr = EPSSetConvergenceTest(eps,EPS_CONV_ABS);CHKERRQ(ierr);}
|
| 526 |
dsic.upv.es!antodo |
117 |
|
| 1599 |
slepc |
118 |
i = j = k = PETSC_IGNORE;
|
| 1282 |
slepc |
119 |
ierr = PetscOptionsInt("-eps_nev","Number of eigenvalues to compute","EPSSetDimensions",eps->nev,&i,PETSC_NULL);CHKERRQ(ierr);
|
|
|
120 |
ierr = PetscOptionsInt("-eps_ncv","Number of basis vectors","EPSSetDimensions",eps->ncv,&j,PETSC_NULL);CHKERRQ(ierr);
|
| 1575 |
slepc |
121 |
ierr = PetscOptionsInt("-eps_mpd","Maximum dimension of projected problem","EPSSetDimensions",eps->mpd,&k,PETSC_NULL);CHKERRQ(ierr);
|
|
|
122 |
ierr = EPSSetDimensions(eps,i,j,k);CHKERRQ(ierr);
|
| 1282 |
slepc |
123 |
|
| 526 |
dsic.upv.es!antodo |
124 |
/* -----------------------------------------------------------------------*/
|
|
|
125 |
/*
|
|
|
126 |
Cancels all monitors hardwired into code before call to EPSSetFromOptions()
|
|
|
127 |
*/
|
| 1713 |
antodo |
128 |
flg = PETSC_FALSE;
|
| 2216 |
jroman |
129 |
ierr = PetscOptionsBool("-eps_monitor_cancel","Remove any hardwired monitor routines","EPSMonitorCancel",flg,&flg,PETSC_NULL);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
130 |
if (flg) {
|
| 2330 |
jroman |
131 |
ierr = EPSMonitorCancel(eps);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
132 |
}
|
|
|
133 |
/*
|
|
|
134 |
Prints approximate eigenvalues and error estimates at each iteration
|
|
|
135 |
*/
|
| 2041 |
eromero |
136 |
ierr = PetscOptionsString("-eps_monitor","Monitor first unconverged approximate eigenvalue and error estimate","EPSMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
137 |
if (flg) {
|
| 2419 |
jroman |
138 |
ierr = PetscViewerASCIIOpen(((PetscObject)eps)->comm,monfilename,&monviewer);CHKERRQ(ierr);
|
|
|
139 |
ierr = EPSMonitorSet(eps,EPSMonitorFirst,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
140 |
}
|
| 1721 |
antodo |
141 |
ierr = PetscOptionsString("-eps_monitor_conv","Monitor approximate eigenvalues and error estimates as they converge","EPSMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
|
|
|
142 |
if (flg) {
|
| 2311 |
jroman |
143 |
ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx);CHKERRQ(ierr);
|
| 2419 |
jroman |
144 |
ierr = PetscViewerASCIIOpen(((PetscObject)eps)->comm,monfilename,&ctx->viewer);CHKERRQ(ierr);
|
| 2351 |
jroman |
145 |
ierr = EPSMonitorSet(eps,EPSMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);CHKERRQ(ierr);
|
| 1721 |
antodo |
146 |
}
|
| 2041 |
eromero |
147 |
ierr = PetscOptionsString("-eps_monitor_all","Monitor approximate eigenvalues and error estimates","EPSMonitorSet","stdout",monfilename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
|
| 1721 |
antodo |
148 |
if (flg) {
|
| 2419 |
jroman |
149 |
ierr = PetscViewerASCIIOpen(((PetscObject)eps)->comm,monfilename,&monviewer);CHKERRQ(ierr);
|
|
|
150 |
ierr = EPSMonitorSet(eps,EPSMonitorAll,monviewer,(PetscErrorCode (*)(void**))PetscViewerDestroy);CHKERRQ(ierr);
|
| 2041 |
eromero |
151 |
ierr = EPSSetTrackAll(eps,PETSC_TRUE);CHKERRQ(ierr);
|
| 1721 |
antodo |
152 |
}
|
| 1713 |
antodo |
153 |
flg = PETSC_FALSE;
|
| 2216 |
jroman |
154 |
ierr = PetscOptionsBool("-eps_monitor_draw","Monitor first unconverged approximate eigenvalue and error estimate graphically","EPSMonitorSet",flg,&flg,PETSC_NULL);CHKERRQ(ierr);
|
| 623 |
dsic.upv.es!antodo |
155 |
if (flg) {
|
| 1331 |
slepc |
156 |
ierr = EPSMonitorSet(eps,EPSMonitorLG,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
|
| 623 |
dsic.upv.es!antodo |
157 |
}
|
| 2041 |
eromero |
158 |
flg = PETSC_FALSE;
|
| 2216 |
jroman |
159 |
ierr = PetscOptionsBool("-eps_monitor_draw_all","Monitor error estimates graphically","EPSMonitorSet",flg,&flg,PETSC_NULL);CHKERRQ(ierr);
|
| 2041 |
eromero |
160 |
if (flg) {
|
|
|
161 |
ierr = EPSMonitorSet(eps,EPSMonitorLGAll,PETSC_NULL,PETSC_NULL);CHKERRQ(ierr);
|
|
|
162 |
ierr = EPSSetTrackAll(eps,PETSC_TRUE);CHKERRQ(ierr);
|
|
|
163 |
}
|
| 526 |
dsic.upv.es!antodo |
164 |
/* -----------------------------------------------------------------------*/
|
| 1782 |
antodo |
165 |
ierr = PetscOptionsScalar("-eps_target","Value of the target","EPSSetTarget",eps->target,&s,&flg);CHKERRQ(ierr);
|
|
|
166 |
if (flg) {
|
|
|
167 |
ierr = EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE);CHKERRQ(ierr);
|
|
|
168 |
ierr = EPSSetTarget(eps,s);CHKERRQ(ierr);
|
|
|
169 |
}
|
| 2403 |
jroman |
170 |
k = 2;
|
|
|
171 |
ierr = PetscOptionsRealArray("-eps_interval","Computational interval (two real values separated with a comma without spaces)","EPSSetInterval",array,&k,&flg);CHKERRQ(ierr);
|
|
|
172 |
if (flg) {
|
|
|
173 |
if (k<2) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_SIZ,"Must pass two values in -eps_interval (comma-separated without spaces)");
|
|
|
174 |
ierr = EPSSetWhichEigenpairs(eps,EPS_ALL);CHKERRQ(ierr);
|
|
|
175 |
ierr = EPSSetInterval(eps,array[0],array[1]);CHKERRQ(ierr);
|
|
|
176 |
}
|
| 1782 |
antodo |
177 |
|
| 2216 |
jroman |
178 |
ierr = PetscOptionsBoolGroupBegin("-eps_largest_magnitude","compute largest eigenvalues in magnitude","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
179 |
if (flg) {ierr = EPSSetWhichEigenpairs(eps,EPS_LARGEST_MAGNITUDE);CHKERRQ(ierr);}
|
| 2216 |
jroman |
180 |
ierr = PetscOptionsBoolGroup("-eps_smallest_magnitude","compute smallest eigenvalues in magnitude","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
181 |
if (flg) {ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_MAGNITUDE);CHKERRQ(ierr);}
|
| 2216 |
jroman |
182 |
ierr = PetscOptionsBoolGroup("-eps_largest_real","compute largest real parts","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
183 |
if (flg) {ierr = EPSSetWhichEigenpairs(eps,EPS_LARGEST_REAL);CHKERRQ(ierr);}
|
| 2216 |
jroman |
184 |
ierr = PetscOptionsBoolGroup("-eps_smallest_real","compute smallest real parts","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
185 |
if (flg) {ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_REAL);CHKERRQ(ierr);}
|
| 2216 |
jroman |
186 |
ierr = PetscOptionsBoolGroup("-eps_largest_imaginary","compute largest imaginary parts","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
187 |
if (flg) {ierr = EPSSetWhichEigenpairs(eps,EPS_LARGEST_IMAGINARY);CHKERRQ(ierr);}
|
| 2216 |
jroman |
188 |
ierr = PetscOptionsBoolGroup("-eps_smallest_imaginary","compute smallest imaginary parts","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
189 |
if (flg) {ierr = EPSSetWhichEigenpairs(eps,EPS_SMALLEST_IMAGINARY);CHKERRQ(ierr);}
|
| 2216 |
jroman |
190 |
ierr = PetscOptionsBoolGroup("-eps_target_magnitude","compute nearest eigenvalues to target","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
| 1782 |
antodo |
191 |
if (flg) {ierr = EPSSetWhichEigenpairs(eps,EPS_TARGET_MAGNITUDE);CHKERRQ(ierr);}
|
| 2216 |
jroman |
192 |
ierr = PetscOptionsBoolGroup("-eps_target_real","compute eigenvalues with real parts close to target","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
| 1782 |
antodo |
193 |
if (flg) {ierr = EPSSetWhichEigenpairs(eps,EPS_TARGET_REAL);CHKERRQ(ierr);}
|
| 2403 |
jroman |
194 |
ierr = PetscOptionsBoolGroup("-eps_target_imaginary","compute eigenvalues with imaginary parts close to target","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
| 1782 |
antodo |
195 |
if (flg) {ierr = EPSSetWhichEigenpairs(eps,EPS_TARGET_IMAGINARY);CHKERRQ(ierr);}
|
| 2403 |
jroman |
196 |
ierr = PetscOptionsBoolGroupEnd("-eps_all","compute all eigenvalues in an interval","EPSSetWhichEigenpairs",&flg);CHKERRQ(ierr);
|
|
|
197 |
if (flg) {ierr = EPSSetWhichEigenpairs(eps,EPS_ALL);CHKERRQ(ierr);}
|
| 526 |
dsic.upv.es!antodo |
198 |
|
| 2216 |
jroman |
199 |
ierr = PetscOptionsBool("-eps_left_vectors","Compute left eigenvectors also","EPSSetLeftVectorsWanted",eps->leftvecs,&val,&flg);CHKERRQ(ierr);
|
| 1944 |
jroman |
200 |
if (flg) {
|
|
|
201 |
ierr = EPSSetLeftVectorsWanted(eps,val);CHKERRQ(ierr);
|
|
|
202 |
}
|
| 2216 |
jroman |
203 |
ierr = PetscOptionsBool("-eps_true_residual","Compute true residuals explicitly","EPSSetTrueResidual",eps->trueres,&val,&flg);CHKERRQ(ierr);
|
| 2031 |
jroman |
204 |
if (flg) {
|
|
|
205 |
ierr = EPSSetTrueResidual(eps,val);CHKERRQ(ierr);
|
|
|
206 |
}
|
| 1944 |
jroman |
207 |
|
| 1957 |
jroman |
208 |
nrma = nrmb = PETSC_IGNORE;
|
|
|
209 |
ierr = PetscOptionsReal("-eps_norm_a","Norm of matrix A","EPSSetMatrixNorms",eps->nrma,&nrma,PETSC_NULL);CHKERRQ(ierr);
|
|
|
210 |
ierr = PetscOptionsReal("-eps_norm_b","Norm of matrix B","EPSSetMatrixNorms",eps->nrmb,&nrmb,PETSC_NULL);CHKERRQ(ierr);
|
|
|
211 |
ierr = EPSSetMatrixNorms(eps,nrma,nrmb,eps->adaptive);CHKERRQ(ierr);
|
| 2216 |
jroman |
212 |
ierr = PetscOptionsBool("-eps_norms_adaptive","Update the value of matrix norms adaptively","EPSSetMatrixNorms",eps->adaptive,&val,&flg);CHKERRQ(ierr);
|
| 1957 |
jroman |
213 |
if (flg) {
|
|
|
214 |
ierr = EPSSetMatrixNorms(eps,PETSC_IGNORE,PETSC_IGNORE,val);CHKERRQ(ierr);
|
|
|
215 |
}
|
|
|
216 |
|
| 526 |
dsic.upv.es!antodo |
217 |
ierr = PetscOptionsName("-eps_view","Print detailed information on solver used","EPSView",0);CHKERRQ(ierr);
|
|
|
218 |
ierr = PetscOptionsName("-eps_view_binary","Save the matrices associated to the eigenproblem","EPSSetFromOptions",0);CHKERRQ(ierr);
|
|
|
219 |
ierr = PetscOptionsName("-eps_plot_eigs","Make a plot of the computed eigenvalues","EPSSolve",0);CHKERRQ(ierr);
|
| 1209 |
slepc |
220 |
|
| 526 |
dsic.upv.es!antodo |
221 |
if (eps->ops->setfromoptions) {
|
|
|
222 |
ierr = (*eps->ops->setfromoptions)(eps);CHKERRQ(ierr);
|
|
|
223 |
}
|
| 2384 |
jroman |
224 |
ierr = PetscObjectProcessOptionsHandlers((PetscObject)eps);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
225 |
ierr = PetscOptionsEnd();CHKERRQ(ierr);
|
|
|
226 |
|
| 2381 |
jroman |
227 |
if (!eps->ip) { ierr = EPSGetIP(eps,&eps->ip);CHKERRQ(ierr); }
|
| 2330 |
jroman |
228 |
ierr = IPSetFromOptions(eps->ip);CHKERRQ(ierr);
|
|
|
229 |
ierr = STSetFromOptions(eps->OP);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
230 |
PetscFunctionReturn(0);
|
|
|
231 |
}
|
|
|
232 |
|
|
|
233 |
#undef __FUNCT__
|
|
|
234 |
#define __FUNCT__ "EPSGetTolerances"
|
|
|
235 |
/*@
|
| 1811 |
jroman |
236 |
EPSGetTolerances - Gets the tolerance and maximum iteration count used
|
|
|
237 |
by the EPS convergence tests.
|
| 526 |
dsic.upv.es!antodo |
238 |
|
|
|
239 |
Not Collective
|
|
|
240 |
|
|
|
241 |
Input Parameter:
|
|
|
242 |
. eps - the eigensolver context
|
|
|
243 |
|
|
|
244 |
Output Parameters:
|
|
|
245 |
+ tol - the convergence tolerance
|
|
|
246 |
- maxits - maximum number of iterations
|
|
|
247 |
|
|
|
248 |
Notes:
|
|
|
249 |
The user can specify PETSC_NULL for any parameter that is not needed.
|
|
|
250 |
|
|
|
251 |
Level: intermediate
|
|
|
252 |
|
|
|
253 |
.seealso: EPSSetTolerances()
|
|
|
254 |
@*/
|
| 1509 |
slepc |
255 |
PetscErrorCode EPSGetTolerances(EPS eps,PetscReal *tol,PetscInt *maxits)
|
| 526 |
dsic.upv.es!antodo |
256 |
{
|
|
|
257 |
PetscFunctionBegin;
|
| 2213 |
jroman |
258 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 526 |
dsic.upv.es!antodo |
259 |
if (tol) *tol = eps->tol;
|
|
|
260 |
if (maxits) *maxits = eps->max_it;
|
|
|
261 |
PetscFunctionReturn(0);
|
|
|
262 |
}
|
|
|
263 |
|
|
|
264 |
#undef __FUNCT__
|
|
|
265 |
#define __FUNCT__ "EPSSetTolerances"
|
|
|
266 |
/*@
|
| 1811 |
jroman |
267 |
EPSSetTolerances - Sets the tolerance and maximum iteration count used
|
|
|
268 |
by the EPS convergence tests.
|
| 526 |
dsic.upv.es!antodo |
269 |
|
| 2328 |
jroman |
270 |
Logically Collective on EPS
|
| 526 |
dsic.upv.es!antodo |
271 |
|
|
|
272 |
Input Parameters:
|
|
|
273 |
+ eps - the eigensolver context
|
|
|
274 |
. tol - the convergence tolerance
|
|
|
275 |
- maxits - maximum number of iterations to use
|
|
|
276 |
|
|
|
277 |
Options Database Keys:
|
|
|
278 |
+ -eps_tol <tol> - Sets the convergence tolerance
|
|
|
279 |
- -eps_max_it <maxits> - Sets the maximum number of iterations allowed
|
|
|
280 |
|
|
|
281 |
Notes:
|
| 1284 |
slepc |
282 |
Use PETSC_IGNORE for an argument that need not be changed.
|
| 526 |
dsic.upv.es!antodo |
283 |
|
| 1282 |
slepc |
284 |
Use PETSC_DECIDE for maxits to assign a reasonably good value, which is
|
|
|
285 |
dependent on the solution method.
|
|
|
286 |
|
| 526 |
dsic.upv.es!antodo |
287 |
Level: intermediate
|
|
|
288 |
|
|
|
289 |
.seealso: EPSGetTolerances()
|
|
|
290 |
@*/
|
| 1509 |
slepc |
291 |
PetscErrorCode EPSSetTolerances(EPS eps,PetscReal tol,PetscInt maxits)
|
| 526 |
dsic.upv.es!antodo |
292 |
{
|
|
|
293 |
PetscFunctionBegin;
|
| 2213 |
jroman |
294 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
295 |
PetscValidLogicalCollectiveReal(eps,tol,2);
|
|
|
296 |
PetscValidLogicalCollectiveInt(eps,maxits,3);
|
| 1282 |
slepc |
297 |
if (tol != PETSC_IGNORE) {
|
|
|
298 |
if (tol == PETSC_DEFAULT) {
|
|
|
299 |
eps->tol = 1e-7;
|
|
|
300 |
} else {
|
| 2214 |
jroman |
301 |
if (tol < 0.0) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of tol. Must be > 0");
|
| 1282 |
slepc |
302 |
eps->tol = tol;
|
|
|
303 |
}
|
| 1276 |
slepc |
304 |
}
|
| 1282 |
slepc |
305 |
if (maxits != PETSC_IGNORE) {
|
|
|
306 |
if (maxits == PETSC_DEFAULT || maxits == PETSC_DECIDE) {
|
|
|
307 |
eps->max_it = 0;
|
| 1886 |
jroman |
308 |
eps->setupcalled = 0;
|
| 1282 |
slepc |
309 |
} else {
|
| 2214 |
jroman |
310 |
if (maxits < 0) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of maxits. Must be > 0");
|
| 1282 |
slepc |
311 |
eps->max_it = maxits;
|
|
|
312 |
}
|
| 1276 |
slepc |
313 |
}
|
| 526 |
dsic.upv.es!antodo |
314 |
PetscFunctionReturn(0);
|
|
|
315 |
}
|
|
|
316 |
|
|
|
317 |
#undef __FUNCT__
|
|
|
318 |
#define __FUNCT__ "EPSGetDimensions"
|
|
|
319 |
/*@
|
|
|
320 |
EPSGetDimensions - Gets the number of eigenvalues to compute
|
|
|
321 |
and the dimension of the subspace.
|
|
|
322 |
|
|
|
323 |
Not Collective
|
|
|
324 |
|
|
|
325 |
Input Parameter:
|
|
|
326 |
. eps - the eigensolver context
|
|
|
327 |
|
|
|
328 |
Output Parameters:
|
|
|
329 |
+ nev - number of eigenvalues to compute
|
| 1575 |
slepc |
330 |
. ncv - the maximum dimension of the subspace to be used by the solver
|
|
|
331 |
- mpd - the maximum dimension allowed for the projected problem
|
| 526 |
dsic.upv.es!antodo |
332 |
|
|
|
333 |
Notes:
|
|
|
334 |
The user can specify PETSC_NULL for any parameter that is not needed.
|
|
|
335 |
|
|
|
336 |
Level: intermediate
|
|
|
337 |
|
|
|
338 |
.seealso: EPSSetDimensions()
|
|
|
339 |
@*/
|
| 1575 |
slepc |
340 |
PetscErrorCode EPSGetDimensions(EPS eps,PetscInt *nev,PetscInt *ncv,PetscInt *mpd)
|
| 526 |
dsic.upv.es!antodo |
341 |
{
|
|
|
342 |
PetscFunctionBegin;
|
| 2213 |
jroman |
343 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 1575 |
slepc |
344 |
if (nev) *nev = eps->nev;
|
|
|
345 |
if (ncv) *ncv = eps->ncv;
|
|
|
346 |
if (mpd) *mpd = eps->mpd;
|
| 526 |
dsic.upv.es!antodo |
347 |
PetscFunctionReturn(0);
|
|
|
348 |
}
|
|
|
349 |
|
|
|
350 |
#undef __FUNCT__
|
|
|
351 |
#define __FUNCT__ "EPSSetDimensions"
|
|
|
352 |
/*@
|
|
|
353 |
EPSSetDimensions - Sets the number of eigenvalues to compute
|
|
|
354 |
and the dimension of the subspace.
|
|
|
355 |
|
| 2328 |
jroman |
356 |
Logically Collective on EPS
|
| 526 |
dsic.upv.es!antodo |
357 |
|
|
|
358 |
Input Parameters:
|
|
|
359 |
+ eps - the eigensolver context
|
|
|
360 |
. nev - number of eigenvalues to compute
|
| 1575 |
slepc |
361 |
. ncv - the maximum dimension of the subspace to be used by the solver
|
|
|
362 |
- mpd - the maximum dimension allowed for the projected problem
|
| 526 |
dsic.upv.es!antodo |
363 |
|
|
|
364 |
Options Database Keys:
|
|
|
365 |
+ -eps_nev <nev> - Sets the number of eigenvalues
|
| 1575 |
slepc |
366 |
. -eps_ncv <ncv> - Sets the dimension of the subspace
|
|
|
367 |
- -eps_mpd <mpd> - Sets the maximum projected dimension
|
| 526 |
dsic.upv.es!antodo |
368 |
|
|
|
369 |
Notes:
|
| 1282 |
slepc |
370 |
Use PETSC_IGNORE to retain the previous value of any parameter.
|
| 526 |
dsic.upv.es!antodo |
371 |
|
| 1575 |
slepc |
372 |
Use PETSC_DECIDE for ncv and mpd to assign a reasonably good value, which is
|
| 526 |
dsic.upv.es!antodo |
373 |
dependent on the solution method.
|
|
|
374 |
|
| 1575 |
slepc |
375 |
The parameters ncv and mpd are intimately related, so that the user is advised
|
| 2242 |
jroman |
376 |
to set one of them at most. Normal usage is the following:
|
|
|
377 |
(a) In cases where nev is small, the user sets ncv (a reasonable default is 2*nev).
|
|
|
378 |
(b) In cases where nev is large, the user sets mpd.
|
| 1575 |
slepc |
379 |
|
|
|
380 |
The value of ncv should always be between nev and (nev+mpd), typically
|
|
|
381 |
ncv=nev+mpd. If nev is not too large, mpd=nev is a reasonable choice, otherwise
|
|
|
382 |
a smaller value should be used.
|
|
|
383 |
|
| 2403 |
jroman |
384 |
When computing all eigenvalues in an interval, see EPSSetInterval(), the
|
|
|
385 |
meaning of nev changes. In that case, the number of eigenvalues in the
|
|
|
386 |
interval is not known a priori; the meaning of nev is then the number of
|
|
|
387 |
eigenvalues that are computed at a time when sweeping the interval from one
|
|
|
388 |
end to the other. The value of nev in this case may have an impact on overall
|
|
|
389 |
performance. The value of ncv should not be assigned in this case.
|
|
|
390 |
|
| 526 |
dsic.upv.es!antodo |
391 |
Level: intermediate
|
|
|
392 |
|
| 2403 |
jroman |
393 |
.seealso: EPSGetDimensions(), EPSSetInterval()
|
| 526 |
dsic.upv.es!antodo |
394 |
@*/
|
| 1575 |
slepc |
395 |
PetscErrorCode EPSSetDimensions(EPS eps,PetscInt nev,PetscInt ncv,PetscInt mpd)
|
| 526 |
dsic.upv.es!antodo |
396 |
{
|
|
|
397 |
PetscFunctionBegin;
|
| 2213 |
jroman |
398 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
399 |
PetscValidLogicalCollectiveInt(eps,nev,2);
|
|
|
400 |
PetscValidLogicalCollectiveInt(eps,ncv,3);
|
|
|
401 |
PetscValidLogicalCollectiveInt(eps,mpd,4);
|
| 2331 |
jroman |
402 |
if (nev != PETSC_IGNORE) {
|
| 2214 |
jroman |
403 |
if (nev<1) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nev. Must be > 0");
|
| 526 |
dsic.upv.es!antodo |
404 |
eps->nev = nev;
|
|
|
405 |
eps->setupcalled = 0;
|
|
|
406 |
}
|
| 2331 |
jroman |
407 |
if (ncv != PETSC_IGNORE) {
|
| 1282 |
slepc |
408 |
if (ncv == PETSC_DECIDE || ncv == PETSC_DEFAULT) {
|
|
|
409 |
eps->ncv = 0;
|
|
|
410 |
} else {
|
| 2214 |
jroman |
411 |
if (ncv<1) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of ncv. Must be > 0");
|
| 526 |
dsic.upv.es!antodo |
412 |
eps->ncv = ncv;
|
|
|
413 |
}
|
|
|
414 |
eps->setupcalled = 0;
|
|
|
415 |
}
|
| 2331 |
jroman |
416 |
if (mpd != PETSC_IGNORE) {
|
| 1575 |
slepc |
417 |
if (mpd == PETSC_DECIDE || mpd == PETSC_DEFAULT) {
|
|
|
418 |
eps->mpd = 0;
|
|
|
419 |
} else {
|
| 2214 |
jroman |
420 |
if (mpd<1) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of mpd. Must be > 0");
|
| 1575 |
slepc |
421 |
eps->mpd = mpd;
|
|
|
422 |
}
|
|
|
423 |
}
|
| 526 |
dsic.upv.es!antodo |
424 |
PetscFunctionReturn(0);
|
|
|
425 |
}
|
|
|
426 |
|
|
|
427 |
#undef __FUNCT__
|
|
|
428 |
#define __FUNCT__ "EPSSetWhichEigenpairs"
|
|
|
429 |
/*@
|
| 2319 |
jroman |
430 |
EPSSetWhichEigenpairs - Specifies which portion of the spectrum is
|
|
|
431 |
to be sought.
|
| 526 |
dsic.upv.es!antodo |
432 |
|
| 2328 |
jroman |
433 |
Logically Collective on EPS
|
| 526 |
dsic.upv.es!antodo |
434 |
|
| 2319 |
jroman |
435 |
Input Parameters:
|
|
|
436 |
+ eps - eigensolver context obtained from EPSCreate()
|
|
|
437 |
- which - the portion of the spectrum to be sought
|
| 526 |
dsic.upv.es!antodo |
438 |
|
| 2319 |
jroman |
439 |
Possible values:
|
|
|
440 |
The parameter 'which' can have one of these values
|
| 526 |
dsic.upv.es!antodo |
441 |
|
|
|
442 |
+ EPS_LARGEST_MAGNITUDE - largest eigenvalues in magnitude (default)
|
|
|
443 |
. EPS_SMALLEST_MAGNITUDE - smallest eigenvalues in magnitude
|
|
|
444 |
. EPS_LARGEST_REAL - largest real parts
|
|
|
445 |
. EPS_SMALLEST_REAL - smallest real parts
|
|
|
446 |
. EPS_LARGEST_IMAGINARY - largest imaginary parts
|
| 1782 |
antodo |
447 |
. EPS_SMALLEST_IMAGINARY - smallest imaginary parts
|
| 1811 |
jroman |
448 |
. EPS_TARGET_MAGNITUDE - eigenvalues closest to the target (in magnitude)
|
|
|
449 |
. EPS_TARGET_REAL - eigenvalues with real part closest to target
|
|
|
450 |
. EPS_TARGET_IMAGINARY - eigenvalues with imaginary part closest to target
|
| 2403 |
jroman |
451 |
. EPS_ALL - all eigenvalues contained in a given interval
|
| 1945 |
jroman |
452 |
- EPS_WHICH_USER - user defined ordering set with EPSSetEigenvalueComparison()
|
| 526 |
dsic.upv.es!antodo |
453 |
|
| 2319 |
jroman |
454 |
Options Database Keys:
|
| 526 |
dsic.upv.es!antodo |
455 |
+ -eps_largest_magnitude - Sets largest eigenvalues in magnitude
|
|
|
456 |
. -eps_smallest_magnitude - Sets smallest eigenvalues in magnitude
|
|
|
457 |
. -eps_largest_real - Sets largest real parts
|
|
|
458 |
. -eps_smallest_real - Sets smallest real parts
|
| 1811 |
jroman |
459 |
. -eps_largest_imaginary - Sets largest imaginary parts
|
|
|
460 |
. -eps_smallest_imaginary - Sets smallest imaginary parts
|
|
|
461 |
. -eps_target_magnitude - Sets eigenvalues closest to target
|
|
|
462 |
. -eps_target_real - Sets real parts closest to target
|
| 2403 |
jroman |
463 |
. -eps_target_imaginary - Sets imaginary parts closest to target
|
|
|
464 |
- -eps_all - Sets all eigenvalues in an interval
|
| 526 |
dsic.upv.es!antodo |
465 |
|
| 2319 |
jroman |
466 |
Notes:
|
|
|
467 |
Not all eigensolvers implemented in EPS account for all the possible values
|
|
|
468 |
stated above. Also, some values make sense only for certain types of
|
|
|
469 |
problems. If SLEPc is compiled for real numbers EPS_LARGEST_IMAGINARY
|
|
|
470 |
and EPS_SMALLEST_IMAGINARY use the absolute value of the imaginary part
|
|
|
471 |
for eigenvalue selection.
|
| 526 |
dsic.upv.es!antodo |
472 |
|
| 2319 |
jroman |
473 |
The target is a scalar value provided with EPSSetTarget().
|
| 1811 |
jroman |
474 |
|
| 2319 |
jroman |
475 |
The criterion EPS_TARGET_IMAGINARY is available only in case PETSc and
|
|
|
476 |
SLEPc have been built with complex scalars.
|
| 1815 |
jroman |
477 |
|
| 2403 |
jroman |
478 |
EPS_ALL is intended for use in combination with an interval (see
|
|
|
479 |
EPSSetInterval()), when all eigenvalues within the interval are requested.
|
|
|
480 |
In that case, the number of eigenvalues is unknown, so the nev parameter
|
|
|
481 |
has a different sense, see EPSSetDimensions().
|
|
|
482 |
|
| 2319 |
jroman |
483 |
Level: intermediate
|
| 526 |
dsic.upv.es!antodo |
484 |
|
| 2403 |
jroman |
485 |
.seealso: EPSGetWhichEigenpairs(), EPSSetTarget(), EPSSetInterval(),
|
|
|
486 |
EPSSetDimensions(), EPSSetEigenvalueComparison(),
|
|
|
487 |
EPSSortEigenvalues(), EPSWhich
|
| 526 |
dsic.upv.es!antodo |
488 |
@*/
|
|
|
489 |
PetscErrorCode EPSSetWhichEigenpairs(EPS eps,EPSWhich which)
|
|
|
490 |
{
|
|
|
491 |
PetscFunctionBegin;
|
| 2213 |
jroman |
492 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
493 |
PetscValidLogicalCollectiveEnum(eps,which,2);
|
| 1942 |
jroman |
494 |
if (which!=PETSC_IGNORE) {
|
|
|
495 |
if (which==PETSC_DECIDE || which==PETSC_DEFAULT) eps->which = (EPSWhich)0;
|
|
|
496 |
else switch (which) {
|
|
|
497 |
case EPS_LARGEST_MAGNITUDE:
|
|
|
498 |
case EPS_SMALLEST_MAGNITUDE:
|
|
|
499 |
case EPS_LARGEST_REAL:
|
|
|
500 |
case EPS_SMALLEST_REAL:
|
|
|
501 |
case EPS_LARGEST_IMAGINARY:
|
|
|
502 |
case EPS_SMALLEST_IMAGINARY:
|
|
|
503 |
case EPS_TARGET_MAGNITUDE:
|
|
|
504 |
case EPS_TARGET_REAL:
|
| 1815 |
jroman |
505 |
#if defined(PETSC_USE_COMPLEX)
|
| 1942 |
jroman |
506 |
case EPS_TARGET_IMAGINARY:
|
| 1815 |
jroman |
507 |
#endif
|
| 2403 |
jroman |
508 |
case EPS_ALL:
|
| 1945 |
jroman |
509 |
case EPS_WHICH_USER:
|
| 1942 |
jroman |
510 |
if (eps->which != which) {
|
|
|
511 |
eps->setupcalled = 0;
|
|
|
512 |
eps->which = which;
|
|
|
513 |
}
|
|
|
514 |
break;
|
|
|
515 |
default:
|
| 2214 |
jroman |
516 |
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'which' value");
|
| 1942 |
jroman |
517 |
}
|
| 1810 |
jroman |
518 |
}
|
| 526 |
dsic.upv.es!antodo |
519 |
PetscFunctionReturn(0);
|
|
|
520 |
}
|
|
|
521 |
|
|
|
522 |
#undef __FUNCT__
|
|
|
523 |
#define __FUNCT__ "EPSGetWhichEigenpairs"
|
| 707 |
dsic.upv.es!antodo |
524 |
/*@C
|
| 2319 |
jroman |
525 |
EPSGetWhichEigenpairs - Returns which portion of the spectrum is to be
|
|
|
526 |
sought.
|
| 526 |
dsic.upv.es!antodo |
527 |
|
| 2319 |
jroman |
528 |
Not Collective
|
| 526 |
dsic.upv.es!antodo |
529 |
|
| 2319 |
jroman |
530 |
Input Parameter:
|
|
|
531 |
. eps - eigensolver context obtained from EPSCreate()
|
| 526 |
dsic.upv.es!antodo |
532 |
|
| 2319 |
jroman |
533 |
Output Parameter:
|
|
|
534 |
. which - the portion of the spectrum to be sought
|
| 526 |
dsic.upv.es!antodo |
535 |
|
| 2319 |
jroman |
536 |
Notes:
|
|
|
537 |
See EPSSetWhichEigenpairs() for possible values of 'which'.
|
| 526 |
dsic.upv.es!antodo |
538 |
|
| 2319 |
jroman |
539 |
Level: intermediate
|
| 526 |
dsic.upv.es!antodo |
540 |
|
| 1364 |
slepc |
541 |
.seealso: EPSSetWhichEigenpairs(), EPSWhich
|
| 526 |
dsic.upv.es!antodo |
542 |
@*/
|
|
|
543 |
PetscErrorCode EPSGetWhichEigenpairs(EPS eps,EPSWhich *which)
|
|
|
544 |
{
|
|
|
545 |
PetscFunctionBegin;
|
| 2213 |
jroman |
546 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 1273 |
slepc |
547 |
PetscValidPointer(which,2);
|
| 526 |
dsic.upv.es!antodo |
548 |
*which = eps->which;
|
|
|
549 |
PetscFunctionReturn(0);
|
|
|
550 |
}
|
|
|
551 |
|
|
|
552 |
#undef __FUNCT__
|
| 1944 |
jroman |
553 |
#define __FUNCT__ "EPSSetLeftVectorsWanted"
|
|
|
554 |
/*@
|
| 2319 |
jroman |
555 |
EPSSetLeftVectorsWanted - Specifies which eigenvectors are required.
|
| 1944 |
jroman |
556 |
|
| 2328 |
jroman |
557 |
Logically Collective on EPS
|
| 1944 |
jroman |
558 |
|
| 2319 |
jroman |
559 |
Input Parameters:
|
|
|
560 |
+ eps - the eigensolver context
|
|
|
561 |
- leftvecs - whether left eigenvectors are required or not
|
| 1944 |
jroman |
562 |
|
| 2319 |
jroman |
563 |
Options Database Keys:
|
|
|
564 |
. -eps_left_vectors <boolean> - Sets/resets the boolean flag 'leftvecs'
|
| 1944 |
jroman |
565 |
|
| 2319 |
jroman |
566 |
Notes:
|
|
|
567 |
If the user sets leftvecs=PETSC_TRUE then the solver uses a variant of
|
|
|
568 |
the algorithm that computes both right and left eigenvectors. This is
|
|
|
569 |
usually much more costly. This option is not available in all solvers.
|
| 1944 |
jroman |
570 |
|
| 2319 |
jroman |
571 |
Level: intermediate
|
| 1944 |
jroman |
572 |
|
|
|
573 |
.seealso: EPSGetLeftVectorsWanted(), EPSGetEigenvectorLeft()
|
|
|
574 |
@*/
|
| 2216 |
jroman |
575 |
PetscErrorCode EPSSetLeftVectorsWanted(EPS eps,PetscBool leftvecs)
|
| 1944 |
jroman |
576 |
{
|
|
|
577 |
PetscFunctionBegin;
|
| 2213 |
jroman |
578 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
579 |
PetscValidLogicalCollectiveBool(eps,leftvecs,2);
|
| 1948 |
jroman |
580 |
if (eps->leftvecs != leftvecs) {
|
|
|
581 |
eps->leftvecs = leftvecs;
|
|
|
582 |
eps->setupcalled = 0;
|
|
|
583 |
}
|
| 1944 |
jroman |
584 |
PetscFunctionReturn(0);
|
|
|
585 |
}
|
|
|
586 |
|
|
|
587 |
#undef __FUNCT__
|
|
|
588 |
#define __FUNCT__ "EPSGetLeftVectorsWanted"
|
| 2032 |
eromero |
589 |
/*@
|
| 2319 |
jroman |
590 |
EPSGetLeftVectorsWanted - Returns the flag indicating whether left
|
|
|
591 |
eigenvectors are required or not.
|
| 1944 |
jroman |
592 |
|
| 2319 |
jroman |
593 |
Not Collective
|
| 1944 |
jroman |
594 |
|
| 2319 |
jroman |
595 |
Input Parameter:
|
|
|
596 |
. eps - the eigensolver context
|
| 1944 |
jroman |
597 |
|
| 2319 |
jroman |
598 |
Output Parameter:
|
|
|
599 |
. leftvecs - the returned flag
|
| 1944 |
jroman |
600 |
|
| 2319 |
jroman |
601 |
Level: intermediate
|
| 1944 |
jroman |
602 |
|
|
|
603 |
.seealso: EPSSetLeftVectorsWanted(), EPSWhich
|
|
|
604 |
@*/
|
| 2216 |
jroman |
605 |
PetscErrorCode EPSGetLeftVectorsWanted(EPS eps,PetscBool *leftvecs)
|
| 1944 |
jroman |
606 |
{
|
|
|
607 |
PetscFunctionBegin;
|
| 2213 |
jroman |
608 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 1944 |
jroman |
609 |
PetscValidPointer(leftvecs,2);
|
|
|
610 |
*leftvecs = eps->leftvecs;
|
|
|
611 |
PetscFunctionReturn(0);
|
|
|
612 |
}
|
|
|
613 |
|
|
|
614 |
#undef __FUNCT__
|
| 1957 |
jroman |
615 |
#define __FUNCT__ "EPSSetMatrixNorms"
|
|
|
616 |
/*@
|
| 2319 |
jroman |
617 |
EPSSetMatrixNorms - Gives the reference values of the matrix norms
|
|
|
618 |
and specifies whether these values should be improved adaptively.
|
| 1957 |
jroman |
619 |
|
| 2328 |
jroman |
620 |
Logically Collective on EPS
|
| 1957 |
jroman |
621 |
|
| 2319 |
jroman |
622 |
Input Parameters:
|
|
|
623 |
+ eps - the eigensolver context
|
|
|
624 |
. nrma - a reference value for the norm of matrix A
|
|
|
625 |
. nrmb - a reference value for the norm of matrix B
|
|
|
626 |
- adaptive - whether matrix norms are improved adaptively
|
| 1957 |
jroman |
627 |
|
| 2319 |
jroman |
628 |
Options Database Keys:
|
|
|
629 |
+ -eps_norm_a <nrma> - norm of A
|
|
|
630 |
. -eps_norm_b <nrma> - norm of B
|
|
|
631 |
- -eps_norms_adaptive <boolean> - Sets/resets the boolean flag 'adaptive'
|
| 1957 |
jroman |
632 |
|
| 2319 |
jroman |
633 |
Notes:
|
|
|
634 |
If the user sets adaptive=PETSC_FALSE then the solver uses the values
|
|
|
635 |
of nrma and nrmb for the matrix norms, and these values do not change
|
|
|
636 |
throughout the iteration.
|
| 1957 |
jroman |
637 |
|
| 2319 |
jroman |
638 |
If the user sets adaptive=PETSC_TRUE then the solver tries to adaptively
|
|
|
639 |
improve the supplied values, with the numerical information generated
|
|
|
640 |
during the iteration. This option is not available in all solvers.
|
| 1957 |
jroman |
641 |
|
| 2319 |
jroman |
642 |
If a passed value is PETSC_DEFAULT, the corresponding norm will be set to 1.
|
|
|
643 |
If a passed value is PETSC_DETERMINE, the corresponding norm will be computed
|
|
|
644 |
as the NORM_INFINITY with MatNorm().
|
| 1957 |
jroman |
645 |
|
| 2319 |
jroman |
646 |
Level: intermediate
|
| 1957 |
jroman |
647 |
|
|
|
648 |
.seealso: EPSGetMatrixNorms()
|
|
|
649 |
@*/
|
| 2216 |
jroman |
650 |
PetscErrorCode EPSSetMatrixNorms(EPS eps,PetscReal nrma,PetscReal nrmb,PetscBool adaptive)
|
| 1957 |
jroman |
651 |
{
|
|
|
652 |
PetscFunctionBegin;
|
| 2213 |
jroman |
653 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
654 |
PetscValidLogicalCollectiveReal(eps,nrma,2);
|
|
|
655 |
PetscValidLogicalCollectiveReal(eps,nrmb,3);
|
|
|
656 |
PetscValidLogicalCollectiveBool(eps,adaptive,4);
|
| 1957 |
jroman |
657 |
if (nrma != PETSC_IGNORE) {
|
|
|
658 |
if (nrma == PETSC_DEFAULT) eps->nrma = 1.0;
|
|
|
659 |
else if (nrma == PETSC_DETERMINE) {
|
|
|
660 |
eps->nrma = nrma;
|
|
|
661 |
eps->setupcalled = 0;
|
|
|
662 |
} else {
|
| 2214 |
jroman |
663 |
if (nrma < 0.0) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nrma. Must be > 0");
|
| 1957 |
jroman |
664 |
eps->nrma = nrma;
|
|
|
665 |
}
|
|
|
666 |
}
|
|
|
667 |
if (nrmb != PETSC_IGNORE) {
|
| 2214 |
jroman |
668 |
if (!eps->isgeneralized) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_WRONG,"Norm of B only allowed in generalized problems");
|
| 1957 |
jroman |
669 |
if (nrmb == PETSC_DEFAULT) eps->nrmb = 1.0;
|
|
|
670 |
else if (nrmb == PETSC_DETERMINE) {
|
|
|
671 |
eps->nrmb = nrmb;
|
|
|
672 |
eps->setupcalled = 0;
|
|
|
673 |
} else {
|
| 2214 |
jroman |
674 |
if (nrmb < 0.0) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Illegal value of nrmb. Must be > 0");
|
| 1957 |
jroman |
675 |
eps->nrmb = nrmb;
|
|
|
676 |
}
|
|
|
677 |
}
|
|
|
678 |
if (eps->adaptive != adaptive) {
|
|
|
679 |
eps->adaptive = adaptive;
|
|
|
680 |
eps->setupcalled = 0;
|
| 2214 |
jroman |
681 |
if (adaptive) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_SUP,"Sorry, adaptive norms are not implemented in this release.");
|
| 1957 |
jroman |
682 |
}
|
|
|
683 |
PetscFunctionReturn(0);
|
|
|
684 |
}
|
|
|
685 |
|
|
|
686 |
#undef __FUNCT__
|
|
|
687 |
#define __FUNCT__ "EPSGetMatrixNorms"
|
| 2032 |
eromero |
688 |
/*@
|
| 2319 |
jroman |
689 |
EPSGetMatrixNorms - Returns the value of the matrix norms (either set
|
|
|
690 |
by the user or estimated by the solver) and the flag indicating whether
|
|
|
691 |
the norms are being adaptively improved.
|
| 1957 |
jroman |
692 |
|
| 2319 |
jroman |
693 |
Not Collective
|
| 1957 |
jroman |
694 |
|
| 2319 |
jroman |
695 |
Input Parameter:
|
|
|
696 |
. eps - the eigensolver context
|
| 1957 |
jroman |
697 |
|
| 2319 |
jroman |
698 |
Output Parameters:
|
|
|
699 |
+ nrma - the norm of matrix A
|
|
|
700 |
. nrmb - the norm of matrix B
|
|
|
701 |
- adaptive - whether matrix norms are improved adaptively
|
| 1957 |
jroman |
702 |
|
| 2319 |
jroman |
703 |
Level: intermediate
|
| 1957 |
jroman |
704 |
|
|
|
705 |
.seealso: EPSSetMatrixNorms()
|
|
|
706 |
@*/
|
| 2216 |
jroman |
707 |
PetscErrorCode EPSGetMatrixNorms(EPS eps,PetscReal *nrma,PetscReal *nrmb,PetscBool *adaptive)
|
| 1957 |
jroman |
708 |
{
|
|
|
709 |
PetscFunctionBegin;
|
| 2213 |
jroman |
710 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 1957 |
jroman |
711 |
if (nrma) *nrma = eps->nrma;
|
|
|
712 |
if (nrmb) *nrmb = eps->nrmb;
|
|
|
713 |
if (adaptive) *adaptive = eps->adaptive;
|
|
|
714 |
PetscFunctionReturn(0);
|
|
|
715 |
}
|
|
|
716 |
|
|
|
717 |
#undef __FUNCT__
|
| 1782 |
antodo |
718 |
#define __FUNCT__ "EPSSetEigenvalueComparison"
|
|
|
719 |
/*@C
|
| 2319 |
jroman |
720 |
EPSSetEigenvalueComparison - Specifies the eigenvalue comparison function
|
|
|
721 |
when EPSSetWhichEigenpairs() is set to EPS_WHICH_USER.
|
| 1811 |
jroman |
722 |
|
| 2328 |
jroman |
723 |
Logically Collective on EPS
|
| 1782 |
antodo |
724 |
|
| 2319 |
jroman |
725 |
Input Parameters:
|
|
|
726 |
+ eps - eigensolver context obtained from EPSCreate()
|
|
|
727 |
. func - a pointer to the comparison function
|
|
|
728 |
- ctx - a context pointer (the last parameter to the comparison function)
|
| 1782 |
antodo |
729 |
|
| 2319 |
jroman |
730 |
Calling Sequence of func:
|
| 1811 |
jroman |
731 |
$ func(EPS eps,PetscScalar ar,PetscScalar ai,PetscScalar br,PetscScalar bi,PetscInt *res,void *ctx)
|
|
|
732 |
|
|
|
733 |
+ eps - eigensolver context obtained from EPSCreate()
|
|
|
734 |
. ar - real part of the 1st eigenvalue
|
|
|
735 |
. ai - imaginary part of the 1st eigenvalue
|
|
|
736 |
. br - real part of the 2nd eigenvalue
|
|
|
737 |
. bi - imaginary part of the 2nd eigenvalue
|
|
|
738 |
. res - result of comparison
|
|
|
739 |
- ctx - optional context, as set by EPSSetEigenvalueComparison()
|
|
|
740 |
|
| 2319 |
jroman |
741 |
Note:
|
|
|
742 |
The returning parameter 'res' can be:
|
|
|
743 |
+ negative - if the 1st eigenvalue is preferred to the 2st one
|
|
|
744 |
. zero - if both eigenvalues are equally preferred
|
|
|
745 |
- positive - if the 2st eigenvalue is preferred to the 1st one
|
| 2097 |
eromero |
746 |
|
| 2319 |
jroman |
747 |
Level: advanced
|
| 1782 |
antodo |
748 |
|
|
|
749 |
.seealso: EPSSetWhichEigenpairs(), EPSSortEigenvalues(), EPSWhich
|
|
|
750 |
@*/
|
|
|
751 |
PetscErrorCode EPSSetEigenvalueComparison(EPS eps,PetscErrorCode (*func)(EPS,PetscScalar,PetscScalar,PetscScalar,PetscScalar,PetscInt*,void*),void* ctx)
|
|
|
752 |
{
|
|
|
753 |
PetscFunctionBegin;
|
| 2326 |
jroman |
754 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 1782 |
antodo |
755 |
eps->which_func = func;
|
| 2348 |
jroman |
756 |
eps->which_ctx = ctx;
|
|
|
757 |
eps->which = EPS_WHICH_USER;
|
| 1782 |
antodo |
758 |
PetscFunctionReturn(0);
|
|
|
759 |
}
|
|
|
760 |
|
|
|
761 |
#undef __FUNCT__
|
| 2083 |
eromero |
762 |
#define __FUNCT__ "EPSSetConvergenceTestFunction"
|
| 1785 |
antodo |
763 |
/*@C
|
| 2319 |
jroman |
764 |
EPSSetConvergenceTestFunction - Sets a function to compute the error estimate
|
|
|
765 |
used in the convergence test.
|
| 1811 |
jroman |
766 |
|
| 2328 |
jroman |
767 |
Logically Collective on EPS
|
| 1785 |
antodo |
768 |
|
| 2319 |
jroman |
769 |
Input Parameters:
|
|
|
770 |
+ eps - eigensolver context obtained from EPSCreate()
|
|
|
771 |
. func - a pointer to the convergence test function
|
|
|
772 |
- ctx - a context pointer (the last parameter to the convergence test function)
|
| 1785 |
antodo |
773 |
|
| 2319 |
jroman |
774 |
Calling Sequence of func:
|
| 2070 |
jroman |
775 |
$ func(EPS eps,PetscScalar eigr,PetscScalar eigi,PetscReal res,PetscReal *errest,void *ctx)
|
| 1811 |
jroman |
776 |
|
|
|
777 |
+ eps - eigensolver context obtained from EPSCreate()
|
| 2030 |
jroman |
778 |
. eigr - real part of the eigenvalue
|
|
|
779 |
. eigi - imaginary part of the eigenvalue
|
| 2070 |
jroman |
780 |
. res - residual norm associated to the eigenpair
|
|
|
781 |
. errest - (output) computed error estimate
|
| 1811 |
jroman |
782 |
- ctx - optional context, as set by EPSSetConvergenceTest()
|
|
|
783 |
|
| 2319 |
jroman |
784 |
Note:
|
|
|
785 |
If the error estimate returned by the convergence test function is less than
|
|
|
786 |
the tolerance, then the eigenvalue is accepted as converged.
|
| 2070 |
jroman |
787 |
|
| 2319 |
jroman |
788 |
Level: advanced
|
| 1785 |
antodo |
789 |
|
| 2083 |
eromero |
790 |
.seealso: EPSSetConvergenceTest(),EPSSetTolerances()
|
| 1785 |
antodo |
791 |
@*/
|
| 2240 |
jroman |
792 |
extern PetscErrorCode EPSSetConvergenceTestFunction(EPS eps,PetscErrorCode (*func)(EPS,PetscScalar,PetscScalar,PetscReal,PetscReal*,void*),void* ctx)
|
| 1785 |
antodo |
793 |
{
|
|
|
794 |
PetscFunctionBegin;
|
| 2213 |
jroman |
795 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 1785 |
antodo |
796 |
eps->conv_func = func;
|
|
|
797 |
eps->conv_ctx = ctx;
|
| 2083 |
eromero |
798 |
if (func == EPSEigRelativeConverged) eps->conv = EPS_CONV_EIG;
|
|
|
799 |
else if (func == EPSNormRelativeConverged) eps->conv = EPS_CONV_NORM;
|
|
|
800 |
else if (func == EPSAbsoluteConverged) eps->conv = EPS_CONV_ABS;
|
|
|
801 |
else eps->conv = EPS_CONV_USER;
|
| 1785 |
antodo |
802 |
PetscFunctionReturn(0);
|
|
|
803 |
}
|
|
|
804 |
|
|
|
805 |
#undef __FUNCT__
|
| 2083 |
eromero |
806 |
#define __FUNCT__ "EPSSetConvergenceTest"
|
|
|
807 |
/*@
|
| 2319 |
jroman |
808 |
EPSSetConvergenceTest - Specifies how to compute the error estimate
|
|
|
809 |
used in the convergence test.
|
| 2083 |
eromero |
810 |
|
| 2328 |
jroman |
811 |
Logically Collective on EPS
|
| 2083 |
eromero |
812 |
|
| 2319 |
jroman |
813 |
Input Parameters:
|
|
|
814 |
+ eps - eigensolver context obtained from EPSCreate()
|
|
|
815 |
- conv - the type of convergence test
|
| 2083 |
eromero |
816 |
|
| 2319 |
jroman |
817 |
Options Database Keys:
|
|
|
818 |
+ -eps_conv_abs - Sets the absolute convergence test
|
|
|
819 |
. -eps_conv_eig - Sets the convergence test relative to the eigenvalue
|
|
|
820 |
- -eps_conv_norm - Sets the convergence test relative to the matrix norms
|
| 2085 |
jroman |
821 |
|
| 2319 |
jroman |
822 |
Note:
|
|
|
823 |
The parameter 'conv' can have one of these values
|
| 2085 |
jroman |
824 |
+ EPS_CONV_ABS - absolute error ||r||
|
|
|
825 |
. EPS_CONV_EIG - error relative to the eigenvalue l, ||r||/|l|
|
|
|
826 |
. EPS_CONV_NORM - error relative to the matrix norms, ||r||/(||A||+|l|*||B||)
|
| 2083 |
eromero |
827 |
- EPS_CONV_USER - function set by EPSSetConvergenceTestFunction()
|
|
|
828 |
|
| 2319 |
jroman |
829 |
Level: intermediate
|
| 2083 |
eromero |
830 |
|
| 2085 |
jroman |
831 |
.seealso: EPSGetConvergenceTest(), EPSSetConvergenceTestFunction(), EPSConv
|
| 2083 |
eromero |
832 |
@*/
|
|
|
833 |
PetscErrorCode EPSSetConvergenceTest(EPS eps,EPSConv conv)
|
|
|
834 |
{
|
|
|
835 |
PetscFunctionBegin;
|
| 2213 |
jroman |
836 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
837 |
PetscValidLogicalCollectiveEnum(eps,conv,2);
|
| 2083 |
eromero |
838 |
switch(conv) {
|
|
|
839 |
case EPS_CONV_EIG: eps->conv_func = EPSEigRelativeConverged; break;
|
|
|
840 |
case EPS_CONV_NORM: eps->conv_func = EPSNormRelativeConverged; break;
|
|
|
841 |
case EPS_CONV_ABS: eps->conv_func = EPSAbsoluteConverged; break;
|
|
|
842 |
case EPS_CONV_USER: break;
|
|
|
843 |
default:
|
| 2214 |
jroman |
844 |
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Invalid 'conv' value");
|
| 2083 |
eromero |
845 |
}
|
|
|
846 |
eps->conv = conv;
|
|
|
847 |
PetscFunctionReturn(0);
|
|
|
848 |
}
|
|
|
849 |
|
|
|
850 |
#undef __FUNCT__
|
|
|
851 |
#define __FUNCT__ "EPSGetConvergenceTest"
|
|
|
852 |
/*@
|
| 2319 |
jroman |
853 |
EPSGetConvergenceTest - Gets the method used to compute the error estimate
|
|
|
854 |
used in the convergence test.
|
| 2083 |
eromero |
855 |
|
| 2328 |
jroman |
856 |
Not Collective
|
| 2083 |
eromero |
857 |
|
| 2319 |
jroman |
858 |
Input Parameters:
|
|
|
859 |
. eps - eigensolver context obtained from EPSCreate()
|
| 2083 |
eromero |
860 |
|
| 2319 |
jroman |
861 |
Output Parameters:
|
|
|
862 |
. conv - the type of convergence test
|
| 2083 |
eromero |
863 |
|
| 2319 |
jroman |
864 |
Level: intermediate
|
| 2083 |
eromero |
865 |
|
| 2085 |
jroman |
866 |
.seealso: EPSSetConvergenceTest(), EPSSetConvergenceTestFunction(), EPSConv
|
| 2083 |
eromero |
867 |
@*/
|
|
|
868 |
PetscErrorCode EPSGetConvergenceTest(EPS eps,EPSConv *conv)
|
|
|
869 |
{
|
|
|
870 |
PetscFunctionBegin;
|
| 2213 |
jroman |
871 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2083 |
eromero |
872 |
PetscValidPointer(conv,2);
|
|
|
873 |
*conv = eps->conv;
|
|
|
874 |
PetscFunctionReturn(0);
|
|
|
875 |
}
|
|
|
876 |
|
|
|
877 |
#undef __FUNCT__
|
| 526 |
dsic.upv.es!antodo |
878 |
#define __FUNCT__ "EPSSetProblemType"
|
|
|
879 |
/*@
|
|
|
880 |
EPSSetProblemType - Specifies the type of the eigenvalue problem.
|
|
|
881 |
|
| 2328 |
jroman |
882 |
Logically Collective on EPS
|
| 526 |
dsic.upv.es!antodo |
883 |
|
|
|
884 |
Input Parameters:
|
|
|
885 |
+ eps - the eigensolver context
|
|
|
886 |
- type - a known type of eigenvalue problem
|
|
|
887 |
|
|
|
888 |
Options Database Keys:
|
|
|
889 |
+ -eps_hermitian - Hermitian eigenvalue problem
|
|
|
890 |
. -eps_gen_hermitian - generalized Hermitian eigenvalue problem
|
|
|
891 |
. -eps_non_hermitian - non-Hermitian eigenvalue problem
|
| 1426 |
slepc |
892 |
. -eps_gen_non_hermitian - generalized non-Hermitian eigenvalue problem
|
|
|
893 |
- -eps_pos_gen_non_hermitian - generalized non-Hermitian eigenvalue problem
|
|
|
894 |
with positive semi-definite B
|
| 526 |
dsic.upv.es!antodo |
895 |
|
| 1426 |
slepc |
896 |
Notes:
|
| 526 |
dsic.upv.es!antodo |
897 |
Allowed values for the problem type are: Hermitian (EPS_HEP), non-Hermitian
|
| 1697 |
slepc |
898 |
(EPS_NHEP), generalized Hermitian (EPS_GHEP), generalized non-Hermitian
|
| 1915 |
jroman |
899 |
(EPS_GNHEP), generalized non-Hermitian with positive semi-definite B
|
|
|
900 |
(EPS_PGNHEP), and generalized Hermitian-indefinite (EPS_GHIEP).
|
| 526 |
dsic.upv.es!antodo |
901 |
|
|
|
902 |
This function must be used to instruct SLEPc to exploit symmetry. If no
|
|
|
903 |
problem type is specified, by default a non-Hermitian problem is assumed
|
|
|
904 |
(either standard or generalized). If the user knows that the problem is
|
| 1697 |
slepc |
905 |
Hermitian (i.e. A=A^H) or generalized Hermitian (i.e. A=A^H, B=B^H, and
|
| 526 |
dsic.upv.es!antodo |
906 |
B positive definite) then it is recommended to set the problem type so
|
|
|
907 |
that eigensolver can exploit these properties.
|
|
|
908 |
|
|
|
909 |
Level: beginner
|
|
|
910 |
|
| 1364 |
slepc |
911 |
.seealso: EPSSetOperators(), EPSSetType(), EPSGetProblemType(), EPSProblemType
|
| 526 |
dsic.upv.es!antodo |
912 |
@*/
|
|
|
913 |
PetscErrorCode EPSSetProblemType(EPS eps,EPSProblemType type)
|
|
|
914 |
{
|
|
|
915 |
PetscFunctionBegin;
|
| 2213 |
jroman |
916 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
917 |
PetscValidLogicalCollectiveEnum(eps,type,2);
|
| 526 |
dsic.upv.es!antodo |
918 |
switch (type) {
|
|
|
919 |
case EPS_HEP:
|
|
|
920 |
eps->isgeneralized = PETSC_FALSE;
|
|
|
921 |
eps->ishermitian = PETSC_TRUE;
|
| 1358 |
slepc |
922 |
eps->ispositive = PETSC_FALSE;
|
| 526 |
dsic.upv.es!antodo |
923 |
break;
|
|
|
924 |
case EPS_NHEP:
|
|
|
925 |
eps->isgeneralized = PETSC_FALSE;
|
|
|
926 |
eps->ishermitian = PETSC_FALSE;
|
| 1358 |
slepc |
927 |
eps->ispositive = PETSC_FALSE;
|
| 526 |
dsic.upv.es!antodo |
928 |
break;
|
|
|
929 |
case EPS_GHEP:
|
|
|
930 |
eps->isgeneralized = PETSC_TRUE;
|
|
|
931 |
eps->ishermitian = PETSC_TRUE;
|
| 1358 |
slepc |
932 |
eps->ispositive = PETSC_TRUE;
|
| 526 |
dsic.upv.es!antodo |
933 |
break;
|
|
|
934 |
case EPS_GNHEP:
|
|
|
935 |
eps->isgeneralized = PETSC_TRUE;
|
|
|
936 |
eps->ishermitian = PETSC_FALSE;
|
| 1358 |
slepc |
937 |
eps->ispositive = PETSC_FALSE;
|
| 526 |
dsic.upv.es!antodo |
938 |
break;
|
| 1358 |
slepc |
939 |
case EPS_PGNHEP:
|
|
|
940 |
eps->isgeneralized = PETSC_TRUE;
|
|
|
941 |
eps->ishermitian = PETSC_FALSE;
|
|
|
942 |
eps->ispositive = PETSC_TRUE;
|
|
|
943 |
break;
|
| 1915 |
jroman |
944 |
case EPS_GHIEP:
|
|
|
945 |
eps->isgeneralized = PETSC_TRUE;
|
|
|
946 |
eps->ishermitian = PETSC_TRUE;
|
|
|
947 |
eps->ispositive = PETSC_FALSE;
|
|
|
948 |
break;
|
| 526 |
dsic.upv.es!antodo |
949 |
default:
|
| 2214 |
jroman |
950 |
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_WRONG,"Unknown eigenvalue problem type");
|
| 526 |
dsic.upv.es!antodo |
951 |
}
|
|
|
952 |
eps->problem_type = type;
|
|
|
953 |
PetscFunctionReturn(0);
|
|
|
954 |
}
|
|
|
955 |
|
|
|
956 |
#undef __FUNCT__
|
|
|
957 |
#define __FUNCT__ "EPSGetProblemType"
|
| 707 |
dsic.upv.es!antodo |
958 |
/*@C
|
| 526 |
dsic.upv.es!antodo |
959 |
EPSGetProblemType - Gets the problem type from the EPS object.
|
|
|
960 |
|
|
|
961 |
Not Collective
|
|
|
962 |
|
|
|
963 |
Input Parameter:
|
|
|
964 |
. eps - the eigensolver context
|
|
|
965 |
|
|
|
966 |
Output Parameter:
|
|
|
967 |
. type - name of EPS problem type
|
|
|
968 |
|
|
|
969 |
Level: intermediate
|
|
|
970 |
|
| 1364 |
slepc |
971 |
.seealso: EPSSetProblemType(), EPSProblemType
|
| 526 |
dsic.upv.es!antodo |
972 |
@*/
|
|
|
973 |
PetscErrorCode EPSGetProblemType(EPS eps,EPSProblemType *type)
|
|
|
974 |
{
|
|
|
975 |
PetscFunctionBegin;
|
| 2213 |
jroman |
976 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 1273 |
slepc |
977 |
PetscValidPointer(type,2);
|
| 526 |
dsic.upv.es!antodo |
978 |
*type = eps->problem_type;
|
|
|
979 |
PetscFunctionReturn(0);
|
|
|
980 |
}
|
|
|
981 |
|
|
|
982 |
#undef __FUNCT__
|
| 1560 |
slepc |
983 |
#define __FUNCT__ "EPSSetExtraction"
|
| 1426 |
slepc |
984 |
/*@
|
| 1560 |
slepc |
985 |
EPSSetExtraction - Specifies the type of extraction technique to be employed
|
| 1426 |
slepc |
986 |
by the eigensolver.
|
|
|
987 |
|
| 2328 |
jroman |
988 |
Logically Collective on EPS
|
| 1426 |
slepc |
989 |
|
|
|
990 |
Input Parameters:
|
|
|
991 |
+ eps - the eigensolver context
|
| 1560 |
slepc |
992 |
- extr - a known type of extraction
|
| 1426 |
slepc |
993 |
|
|
|
994 |
Options Database Keys:
|
| 1560 |
slepc |
995 |
+ -eps_ritz - Rayleigh-Ritz extraction
|
| 2108 |
jroman |
996 |
. -eps_harmonic - harmonic Ritz extraction
|
|
|
997 |
. -eps_harmonic_relative - harmonic Ritz extraction relative to the eigenvalue
|
|
|
998 |
. -eps_harmonic_right - harmonic Ritz extraction for rightmost eigenvalues
|
|
|
999 |
. -eps_harmonic_largest - harmonic Ritz extraction for largest magnitude
|
|
|
1000 |
(without target)
|
| 1560 |
slepc |
1001 |
. -eps_refined - refined Ritz extraction
|
|
|
1002 |
- -eps_refined_harmonic - refined harmonic Ritz extraction
|
| 1426 |
slepc |
1003 |
|
|
|
1004 |
Notes:
|
| 1560 |
slepc |
1005 |
Not all eigensolvers support all types of extraction. See the SLEPc
|
| 1426 |
slepc |
1006 |
Users Manual for details.
|
|
|
1007 |
|
| 1560 |
slepc |
1008 |
By default, a standard Rayleigh-Ritz extraction is used. Other extractions
|
| 1426 |
slepc |
1009 |
may be useful when computing interior eigenvalues.
|
|
|
1010 |
|
| 1560 |
slepc |
1011 |
Harmonic-type extractions are used in combination with a 'target'.
|
| 1426 |
slepc |
1012 |
|
|
|
1013 |
Level: beginner
|
|
|
1014 |
|
| 1560 |
slepc |
1015 |
.seealso: EPSSetTarget(), EPSGetExtraction(), EPSExtraction
|
| 1426 |
slepc |
1016 |
@*/
|
| 1560 |
slepc |
1017 |
PetscErrorCode EPSSetExtraction(EPS eps,EPSExtraction extr)
|
| 1426 |
slepc |
1018 |
{
|
|
|
1019 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1020 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
1021 |
PetscValidLogicalCollectiveEnum(eps,extr,2);
|
| 1560 |
slepc |
1022 |
eps->extraction = extr;
|
| 1426 |
slepc |
1023 |
PetscFunctionReturn(0);
|
|
|
1024 |
}
|
|
|
1025 |
|
|
|
1026 |
#undef __FUNCT__
|
| 1560 |
slepc |
1027 |
#define __FUNCT__ "EPSGetExtraction"
|
| 1426 |
slepc |
1028 |
/*@C
|
| 1560 |
slepc |
1029 |
EPSGetExtraction - Gets the extraction type used by the EPS object.
|
| 1426 |
slepc |
1030 |
|
|
|
1031 |
Not Collective
|
|
|
1032 |
|
|
|
1033 |
Input Parameter:
|
|
|
1034 |
. eps - the eigensolver context
|
|
|
1035 |
|
|
|
1036 |
Output Parameter:
|
| 1560 |
slepc |
1037 |
. extr - name of extraction type
|
| 1426 |
slepc |
1038 |
|
|
|
1039 |
Level: intermediate
|
|
|
1040 |
|
| 1560 |
slepc |
1041 |
.seealso: EPSSetExtraction(), EPSExtraction
|
| 1426 |
slepc |
1042 |
@*/
|
| 1560 |
slepc |
1043 |
PetscErrorCode EPSGetExtraction(EPS eps,EPSExtraction *extr)
|
| 1426 |
slepc |
1044 |
{
|
|
|
1045 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1046 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 1560 |
slepc |
1047 |
PetscValidPointer(extr,2);
|
|
|
1048 |
*extr = eps->extraction;
|
| 1426 |
slepc |
1049 |
PetscFunctionReturn(0);
|
|
|
1050 |
}
|
|
|
1051 |
|
|
|
1052 |
#undef __FUNCT__
|
| 1799 |
jroman |
1053 |
#define __FUNCT__ "EPSSetBalance"
|
|
|
1054 |
/*@
|
|
|
1055 |
EPSSetBalance - Specifies the balancing technique to be employed by the
|
|
|
1056 |
eigensolver, and some parameters associated to it.
|
|
|
1057 |
|
| 2328 |
jroman |
1058 |
Logically Collective on EPS
|
| 1799 |
jroman |
1059 |
|
|
|
1060 |
Input Parameters:
|
|
|
1061 |
+ eps - the eigensolver context
|
| 1940 |
jroman |
1062 |
. bal - the balancing method, one of EPS_BALANCE_NONE, EPS_BALANCE_ONESIDE,
|
|
|
1063 |
EPS_BALANCE_TWOSIDE, or EPS_BALANCE_USER
|
| 1799 |
jroman |
1064 |
. its - number of iterations of the balancing algorithm
|
|
|
1065 |
- cutoff - cutoff value
|
|
|
1066 |
|
|
|
1067 |
Options Database Keys:
|
|
|
1068 |
+ -eps_balance <method> - the balancing method, where <method> is one of
|
| 1804 |
jroman |
1069 |
'none', 'oneside', 'twoside', or 'user'
|
| 1799 |
jroman |
1070 |
. -eps_balance_its <its> - number of iterations
|
|
|
1071 |
- -eps_balance_cutoff <cutoff> - cutoff value
|
|
|
1072 |
|
|
|
1073 |
Notes:
|
|
|
1074 |
When balancing is enabled, the solver works implicitly with matrix DAD^-1,
|
|
|
1075 |
where D is an appropriate diagonal matrix. This improves the accuracy of
|
|
|
1076 |
the computed results in some cases. See the SLEPc Users Manual for details.
|
|
|
1077 |
|
|
|
1078 |
Balancing makes sense only for non-Hermitian problems when the required
|
|
|
1079 |
precision is high (i.e. a small tolerance such as 1e-15).
|
|
|
1080 |
|
|
|
1081 |
By default, balancing is disabled. The two-sided method is much more
|
|
|
1082 |
effective than the one-sided counterpart, but it requires the system
|
|
|
1083 |
matrices to have the MatMultTranspose operation defined.
|
|
|
1084 |
|
|
|
1085 |
The parameter 'its' is the number of iterations performed by the method. The
|
|
|
1086 |
cutoff value is used only in the two-side variant. Use PETSC_IGNORE for an
|
|
|
1087 |
argument that need not be changed. Use PETSC_DECIDE to assign a reasonably
|
|
|
1088 |
good value.
|
|
|
1089 |
|
| 1804 |
jroman |
1090 |
User-defined balancing is allowed provided that the corresponding matrix
|
|
|
1091 |
is set via STSetBalanceMatrix.
|
|
|
1092 |
|
| 1799 |
jroman |
1093 |
Level: intermediate
|
|
|
1094 |
|
| 1804 |
jroman |
1095 |
.seealso: EPSGetBalance(), EPSBalance, STSetBalanceMatrix()
|
| 1799 |
jroman |
1096 |
@*/
|
|
|
1097 |
PetscErrorCode EPSSetBalance(EPS eps,EPSBalance bal,PetscInt its,PetscReal cutoff)
|
|
|
1098 |
{
|
|
|
1099 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1100 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
1101 |
PetscValidLogicalCollectiveEnum(eps,bal,2);
|
|
|
1102 |
PetscValidLogicalCollectiveInt(eps,its,3);
|
|
|
1103 |
PetscValidLogicalCollectiveReal(eps,cutoff,4);
|
| 1799 |
jroman |
1104 |
if (bal!=PETSC_IGNORE) {
|
| 1940 |
jroman |
1105 |
if (bal==PETSC_DECIDE || bal==PETSC_DEFAULT) eps->balance = EPS_BALANCE_TWOSIDE;
|
| 1810 |
jroman |
1106 |
else switch (bal) {
|
| 1940 |
jroman |
1107 |
case EPS_BALANCE_NONE:
|
|
|
1108 |
case EPS_BALANCE_ONESIDE:
|
|
|
1109 |
case EPS_BALANCE_TWOSIDE:
|
|
|
1110 |
case EPS_BALANCE_USER:
|
| 1810 |
jroman |
1111 |
eps->balance = bal;
|
|
|
1112 |
break;
|
|
|
1113 |
default:
|
| 2214 |
jroman |
1114 |
SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_OUTOFRANGE,"Invalid value of argument 'bal'");
|
| 1810 |
jroman |
1115 |
}
|
| 1799 |
jroman |
1116 |
}
|
|
|
1117 |
if (its!=PETSC_IGNORE) {
|
|
|
1118 |
if (its==PETSC_DECIDE || its==PETSC_DEFAULT) eps->balance_its = 5;
|
| 2151 |
jroman |
1119 |
else eps->balance_its = its;
|
| 1799 |
jroman |
1120 |
}
|
|
|
1121 |
if (cutoff!=PETSC_IGNORE) {
|
|
|
1122 |
if (cutoff==PETSC_DECIDE || cutoff==PETSC_DEFAULT) eps->balance_cutoff = 1e-8;
|
| 2151 |
jroman |
1123 |
else eps->balance_cutoff = cutoff;
|
| 1799 |
jroman |
1124 |
}
|
|
|
1125 |
PetscFunctionReturn(0);
|
|
|
1126 |
}
|
|
|
1127 |
|
|
|
1128 |
#undef __FUNCT__
|
|
|
1129 |
#define __FUNCT__ "EPSGetBalance"
|
| 2032 |
eromero |
1130 |
/*@
|
| 1799 |
jroman |
1131 |
EPSGetBalance - Gets the balancing type used by the EPS object, and the associated
|
|
|
1132 |
parameters.
|
|
|
1133 |
|
|
|
1134 |
Not Collective
|
|
|
1135 |
|
|
|
1136 |
Input Parameter:
|
|
|
1137 |
. eps - the eigensolver context
|
|
|
1138 |
|
|
|
1139 |
Output Parameters:
|
|
|
1140 |
+ bal - the balancing method
|
|
|
1141 |
. its - number of iterations of the balancing algorithm
|
|
|
1142 |
- cutoff - cutoff value
|
|
|
1143 |
|
|
|
1144 |
Level: intermediate
|
|
|
1145 |
|
|
|
1146 |
Note:
|
|
|
1147 |
The user can specify PETSC_NULL for any parameter that is not needed.
|
|
|
1148 |
|
|
|
1149 |
.seealso: EPSSetBalance(), EPSBalance
|
|
|
1150 |
@*/
|
|
|
1151 |
PetscErrorCode EPSGetBalance(EPS eps,EPSBalance *bal,PetscInt *its,PetscReal *cutoff)
|
|
|
1152 |
{
|
|
|
1153 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1154 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 1799 |
jroman |
1155 |
if (bal) *bal = eps->balance;
|
|
|
1156 |
if (its) *its = eps->balance_its;
|
|
|
1157 |
if (cutoff) *cutoff = eps->balance_cutoff;
|
|
|
1158 |
PetscFunctionReturn(0);
|
|
|
1159 |
}
|
|
|
1160 |
|
|
|
1161 |
#undef __FUNCT__
|
| 2031 |
jroman |
1162 |
#define __FUNCT__ "EPSSetTrueResidual"
|
|
|
1163 |
/*@
|
| 2319 |
jroman |
1164 |
EPSSetTrueResidual - Specifies if the solver must compute the true residual
|
|
|
1165 |
explicitly or not.
|
| 2031 |
jroman |
1166 |
|
| 2328 |
jroman |
1167 |
Logically Collective on EPS
|
| 2031 |
jroman |
1168 |
|
| 2319 |
jroman |
1169 |
Input Parameters:
|
|
|
1170 |
+ eps - the eigensolver context
|
|
|
1171 |
- trueres - whether true residuals are required or not
|
| 2031 |
jroman |
1172 |
|
| 2319 |
jroman |
1173 |
Options Database Keys:
|
|
|
1174 |
. -eps_true_residual <boolean> - Sets/resets the boolean flag 'trueres'
|
| 2031 |
jroman |
1175 |
|
| 2319 |
jroman |
1176 |
Notes:
|
|
|
1177 |
If the user sets trueres=PETSC_TRUE then the solver explicitly computes
|
|
|
1178 |
the true residual for each eigenpair approximation, and uses it for
|
|
|
1179 |
convergence testing. Computing the residual is usually an expensive
|
|
|
1180 |
operation. Some solvers (e.g., Krylov solvers) can avoid this computation
|
|
|
1181 |
by using a cheap estimate of the residual norm, but this may sometimes
|
|
|
1182 |
give inaccurate results (especially if a spectral transform is being
|
|
|
1183 |
used). On the contrary, preconditioned eigensolvers (e.g., Davidson solvers)
|
|
|
1184 |
do rely on computing the true residual, so this option is irrelevant for them.
|
| 2031 |
jroman |
1185 |
|
| 2319 |
jroman |
1186 |
Level: intermediate
|
| 2031 |
jroman |
1187 |
|
|
|
1188 |
.seealso: EPSGetTrueResidual()
|
|
|
1189 |
@*/
|
| 2216 |
jroman |
1190 |
PetscErrorCode EPSSetTrueResidual(EPS eps,PetscBool trueres)
|
| 2031 |
jroman |
1191 |
{
|
|
|
1192 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1193 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
1194 |
PetscValidLogicalCollectiveBool(eps,trueres,2);
|
| 2031 |
jroman |
1195 |
eps->trueres = trueres;
|
|
|
1196 |
PetscFunctionReturn(0);
|
|
|
1197 |
}
|
|
|
1198 |
|
|
|
1199 |
#undef __FUNCT__
|
|
|
1200 |
#define __FUNCT__ "EPSGetTrueResidual"
|
|
|
1201 |
/*@C
|
| 2319 |
jroman |
1202 |
EPSGetTrueResidual - Returns the flag indicating whether true
|
|
|
1203 |
residuals must be computed explicitly or not.
|
| 2031 |
jroman |
1204 |
|
| 2319 |
jroman |
1205 |
Not Collective
|
| 2031 |
jroman |
1206 |
|
| 2319 |
jroman |
1207 |
Input Parameter:
|
|
|
1208 |
. eps - the eigensolver context
|
| 2031 |
jroman |
1209 |
|
| 2319 |
jroman |
1210 |
Output Parameter:
|
|
|
1211 |
. trueres - the returned flag
|
| 2031 |
jroman |
1212 |
|
| 2319 |
jroman |
1213 |
Level: intermediate
|
| 2031 |
jroman |
1214 |
|
|
|
1215 |
.seealso: EPSSetTrueResidual()
|
|
|
1216 |
@*/
|
| 2216 |
jroman |
1217 |
PetscErrorCode EPSGetTrueResidual(EPS eps,PetscBool *trueres)
|
| 2031 |
jroman |
1218 |
{
|
|
|
1219 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1220 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2031 |
jroman |
1221 |
PetscValidPointer(trueres,2);
|
|
|
1222 |
*trueres = eps->trueres;
|
|
|
1223 |
PetscFunctionReturn(0);
|
|
|
1224 |
}
|
|
|
1225 |
|
| 2041 |
eromero |
1226 |
#undef __FUNCT__
|
|
|
1227 |
#define __FUNCT__ "EPSSetTrackAll"
|
|
|
1228 |
/*@
|
| 2319 |
jroman |
1229 |
EPSSetTrackAll - Specifies if the solver must compute the residual norm of all
|
|
|
1230 |
approximate eigenpairs or not.
|
| 2031 |
jroman |
1231 |
|
| 2328 |
jroman |
1232 |
Logically Collective on EPS
|
| 2041 |
eromero |
1233 |
|
| 2319 |
jroman |
1234 |
Input Parameters:
|
|
|
1235 |
+ eps - the eigensolver context
|
|
|
1236 |
- trackall - whether to compute all residuals or not
|
| 2041 |
eromero |
1237 |
|
| 2319 |
jroman |
1238 |
Notes:
|
|
|
1239 |
If the user sets trackall=PETSC_TRUE then the solver computes (or estimates)
|
|
|
1240 |
the residual norm for each eigenpair approximation. Computing the residual is
|
|
|
1241 |
usually an expensive operation and solvers commonly compute only the residual
|
|
|
1242 |
associated to the first unconverged eigenpair.
|
| 2046 |
jroman |
1243 |
|
| 2319 |
jroman |
1244 |
The options '-eps_monitor_all' and '-eps_monitor_draw_all' automatically
|
|
|
1245 |
activate this option.
|
| 2041 |
eromero |
1246 |
|
| 2319 |
jroman |
1247 |
Level: intermediate
|
| 2041 |
eromero |
1248 |
|
|
|
1249 |
.seealso: EPSGetTrackAll()
|
|
|
1250 |
@*/
|
| 2216 |
jroman |
1251 |
PetscErrorCode EPSSetTrackAll(EPS eps,PetscBool trackall)
|
| 2041 |
eromero |
1252 |
{
|
|
|
1253 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1254 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2326 |
jroman |
1255 |
PetscValidLogicalCollectiveBool(eps,trackall,2);
|
| 2041 |
eromero |
1256 |
eps->trackall = trackall;
|
|
|
1257 |
PetscFunctionReturn(0);
|
|
|
1258 |
}
|
|
|
1259 |
|
| 2031 |
jroman |
1260 |
#undef __FUNCT__
|
| 2041 |
eromero |
1261 |
#define __FUNCT__ "EPSGetTrackAll"
|
| 2048 |
eromero |
1262 |
/*@
|
| 2319 |
jroman |
1263 |
EPSGetTrackAll - Returns the flag indicating whether all residual norms must
|
|
|
1264 |
be computed or not.
|
| 2041 |
eromero |
1265 |
|
| 2319 |
jroman |
1266 |
Not Collective
|
| 2041 |
eromero |
1267 |
|
| 2319 |
jroman |
1268 |
Input Parameter:
|
|
|
1269 |
. eps - the eigensolver context
|
| 2041 |
eromero |
1270 |
|
| 2319 |
jroman |
1271 |
Output Parameter:
|
|
|
1272 |
. trackall - the returned flag
|
| 2041 |
eromero |
1273 |
|
| 2319 |
jroman |
1274 |
Level: intermediate
|
| 2041 |
eromero |
1275 |
|
|
|
1276 |
.seealso: EPSSetTrackAll()
|
|
|
1277 |
@*/
|
| 2216 |
jroman |
1278 |
PetscErrorCode EPSGetTrackAll(EPS eps,PetscBool *trackall)
|
| 2041 |
eromero |
1279 |
{
|
|
|
1280 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1281 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2041 |
eromero |
1282 |
PetscValidPointer(trackall,2);
|
|
|
1283 |
*trackall = eps->trackall;
|
|
|
1284 |
PetscFunctionReturn(0);
|
|
|
1285 |
}
|
|
|
1286 |
|
|
|
1287 |
#undef __FUNCT__
|
| 526 |
dsic.upv.es!antodo |
1288 |
#define __FUNCT__ "EPSSetOptionsPrefix"
|
|
|
1289 |
/*@C
|
|
|
1290 |
EPSSetOptionsPrefix - Sets the prefix used for searching for all
|
|
|
1291 |
EPS options in the database.
|
|
|
1292 |
|
| 2328 |
jroman |
1293 |
Logically Collective on EPS
|
| 526 |
dsic.upv.es!antodo |
1294 |
|
|
|
1295 |
Input Parameters:
|
|
|
1296 |
+ eps - the eigensolver context
|
|
|
1297 |
- prefix - the prefix string to prepend to all EPS option requests
|
|
|
1298 |
|
|
|
1299 |
Notes:
|
|
|
1300 |
A hyphen (-) must NOT be given at the beginning of the prefix name.
|
|
|
1301 |
The first character of all runtime options is AUTOMATICALLY the
|
|
|
1302 |
hyphen.
|
|
|
1303 |
|
|
|
1304 |
For example, to distinguish between the runtime options for two
|
|
|
1305 |
different EPS contexts, one could call
|
|
|
1306 |
.vb
|
|
|
1307 |
EPSSetOptionsPrefix(eps1,"eig1_")
|
|
|
1308 |
EPSSetOptionsPrefix(eps2,"eig2_")
|
|
|
1309 |
.ve
|
|
|
1310 |
|
|
|
1311 |
Level: advanced
|
|
|
1312 |
|
|
|
1313 |
.seealso: EPSAppendOptionsPrefix(), EPSGetOptionsPrefix()
|
|
|
1314 |
@*/
|
| 1248 |
slepc |
1315 |
PetscErrorCode EPSSetOptionsPrefix(EPS eps,const char *prefix)
|
| 526 |
dsic.upv.es!antodo |
1316 |
{
|
|
|
1317 |
PetscErrorCode ierr;
|
| 2317 |
jroman |
1318 |
|
| 526 |
dsic.upv.es!antodo |
1319 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1320 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2371 |
jroman |
1321 |
if (!eps->OP) { ierr = EPSGetST(eps,&eps->OP);CHKERRQ(ierr); }
|
|
|
1322 |
ierr = STSetOptionsPrefix(eps->OP,prefix);CHKERRQ(ierr);
|
| 2331 |
jroman |
1323 |
ierr = PetscObjectSetOptionsPrefix((PetscObject)eps,prefix);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
1324 |
PetscFunctionReturn(0);
|
|
|
1325 |
}
|
|
|
1326 |
|
|
|
1327 |
#undef __FUNCT__
|
|
|
1328 |
#define __FUNCT__ "EPSAppendOptionsPrefix"
|
|
|
1329 |
/*@C
|
|
|
1330 |
EPSAppendOptionsPrefix - Appends to the prefix used for searching for all
|
|
|
1331 |
EPS options in the database.
|
|
|
1332 |
|
| 2328 |
jroman |
1333 |
Logically Collective on EPS
|
| 526 |
dsic.upv.es!antodo |
1334 |
|
|
|
1335 |
Input Parameters:
|
|
|
1336 |
+ eps - the eigensolver context
|
|
|
1337 |
- prefix - the prefix string to prepend to all EPS option requests
|
|
|
1338 |
|
|
|
1339 |
Notes:
|
|
|
1340 |
A hyphen (-) must NOT be given at the beginning of the prefix name.
|
|
|
1341 |
The first character of all runtime options is AUTOMATICALLY the hyphen.
|
|
|
1342 |
|
|
|
1343 |
Level: advanced
|
|
|
1344 |
|
|
|
1345 |
.seealso: EPSSetOptionsPrefix(), EPSGetOptionsPrefix()
|
|
|
1346 |
@*/
|
| 1248 |
slepc |
1347 |
PetscErrorCode EPSAppendOptionsPrefix(EPS eps,const char *prefix)
|
| 526 |
dsic.upv.es!antodo |
1348 |
{
|
|
|
1349 |
PetscErrorCode ierr;
|
| 2317 |
jroman |
1350 |
|
| 526 |
dsic.upv.es!antodo |
1351 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1352 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 2371 |
jroman |
1353 |
if (!eps->OP) { ierr = EPSGetST(eps,&eps->OP);CHKERRQ(ierr); }
|
|
|
1354 |
ierr = STAppendOptionsPrefix(eps->OP,prefix);CHKERRQ(ierr);
|
| 2331 |
jroman |
1355 |
ierr = PetscObjectAppendOptionsPrefix((PetscObject)eps,prefix);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
1356 |
PetscFunctionReturn(0);
|
|
|
1357 |
}
|
|
|
1358 |
|
|
|
1359 |
#undef __FUNCT__
|
|
|
1360 |
#define __FUNCT__ "EPSGetOptionsPrefix"
|
|
|
1361 |
/*@C
|
|
|
1362 |
EPSGetOptionsPrefix - Gets the prefix used for searching for all
|
|
|
1363 |
EPS options in the database.
|
|
|
1364 |
|
|
|
1365 |
Not Collective
|
|
|
1366 |
|
|
|
1367 |
Input Parameters:
|
|
|
1368 |
. eps - the eigensolver context
|
|
|
1369 |
|
|
|
1370 |
Output Parameters:
|
|
|
1371 |
. prefix - pointer to the prefix string used is returned
|
|
|
1372 |
|
|
|
1373 |
Notes: On the fortran side, the user should pass in a string 'prefix' of
|
|
|
1374 |
sufficient length to hold the prefix.
|
|
|
1375 |
|
|
|
1376 |
Level: advanced
|
|
|
1377 |
|
|
|
1378 |
.seealso: EPSSetOptionsPrefix(), EPSAppendOptionsPrefix()
|
|
|
1379 |
@*/
|
| 812 |
dsic.upv.es!antodo |
1380 |
PetscErrorCode EPSGetOptionsPrefix(EPS eps,const char *prefix[])
|
| 526 |
dsic.upv.es!antodo |
1381 |
{
|
|
|
1382 |
PetscErrorCode ierr;
|
| 2317 |
jroman |
1383 |
|
| 526 |
dsic.upv.es!antodo |
1384 |
PetscFunctionBegin;
|
| 2213 |
jroman |
1385 |
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
|
| 1273 |
slepc |
1386 |
PetscValidPointer(prefix,2);
|
| 2331 |
jroman |
1387 |
ierr = PetscObjectGetOptionsPrefix((PetscObject)eps,prefix);CHKERRQ(ierr);
|
| 526 |
dsic.upv.es!antodo |
1388 |
PetscFunctionReturn(0);
|
|
|
1389 |
}
|