1 #ifndef SELDON_FILE_SLEPC_CXX
6 #include <slepc/private/stimpl.h>
7 #include "petsc/src/mat/impls/aij/seq/aij.h"
10 PetscInt nmat,maxnmat;
20 const char* SlepcParam::GetEigensolverChar()
const
24 case POWER :
return EPSPOWER;
25 case SUBSPACE :
return EPSSUBSPACE;
26 case ARNOLDI :
return EPSARNOLDI;
27 case LANCZOS :
return EPSLANCZOS;
28 case KRYLOVSCHUR :
return EPSKRYLOVSCHUR;
29 case GD :
return EPSGD;
30 case JD :
return EPSJD;
31 case RQCG :
return EPSRQCG;
32 case LOBPCG :
return EPSLOBPCG;
33 case CISS :
return EPSCISS;
34 case LAPACK :
return EPSLAPACK;
35 case ARPACK :
return EPSARPACK;
36 case BLZPACK :
return EPSBLZPACK;
37 case TRLAN :
return EPSTRLAN;
38 case BLOPEX :
return EPSBLOPEX;
39 case PRIMME :
return EPSPRIMME;
47 void SetParametersSlepc(
const SlepcParam& param, EPS& eps)
49 int ierr = EPSSetType(eps, param.GetEigensolverChar());
52 cout <<
"Chosen type = " << param.GetEigensolverChar() <<
" Not enabled in Slepc ?" << endl;
56 int solver = param.GetEigensolverType();
57 if (solver == param.BLOPEX)
59 #ifdef SLEPC_HAVE_BLOPEX
60 PetscInt bs = param.GetBlockSize();
62 EPSBLOPEXSetBlockSize(eps, bs);
64 cout <<
"Slepc not compiled with BLOPEX" << endl;
68 else if (solver == param.BLZPACK)
70 #ifdef SLEPC_HAVE_BLZPACK
71 PetscInt bs = param.GetBlockSize();
73 EPSBlzpackSetBlockSize(eps, bs);
75 bs = param.GetNumberOfSteps();
77 EPSBlzpackSetNSteps(eps, bs);
79 cout <<
"Slepc not compiled with BLZPACK" << endl;
83 else if (solver == param.CISS)
85 int type_extraction = param.GetExtractionType();
86 if (type_extraction >= 0)
88 if (type_extraction == param.EXTRACT_RITZ)
89 EPSCISSSetExtraction(eps, EPS_CISS_EXTRACTION_RITZ);
91 EPSCISSSetExtraction(eps, EPS_CISS_EXTRACTION_HANKEL);
94 int type_quad = param.GetQuadratureRuleType();
97 if (type_quad == param.QUADRULE_TRAPEZE)
98 EPSCISSSetQuadRule(eps, EPS_CISS_QUADRULE_TRAPEZOIDAL);
100 EPSCISSSetQuadRule(eps, EPS_CISS_QUADRULE_CHEBYSHEV);
103 PetscScalar a; PetscBool complex_number = PETSC_FALSE;
105 complex_number = PETSC_TRUE;
107 if (param.GetInnerSteps() > 0)
108 EPSCISSSetRefinement(eps, param.GetInnerSteps(), param.GetOuterSteps());
110 if (param.GetNumberIntegrationPoints() > 0)
111 EPSCISSSetSizes(eps, param.GetNumberIntegrationPoints(), param.GetBlockSize(),
112 param.GetMomentSize(), param.GetNumberPartitions(),
113 param.GetMaximumBlockSize(), complex_number);
115 if (param.GetThresholdRank() > 0)
116 EPSCISSSetThreshold(eps, param.GetThresholdRank(), param.GetThresholdSpurious());
118 else if (solver == param.FEAST)
120 #ifdef SLEPC_HAVE_FEAST
121 if (param.GetNumberIntegrationPoints() > 0)
122 EPSFEASTSetNumPoints(eps, param.GetNumberIntegrationPoints());
124 cout <<
"Slepc not compiled with FEAST" << endl;
128 else if (solver == param.GD)
130 if (param.GetBorthogonalization() >= 0)
132 PetscBool borth = PETSC_FALSE;
133 if (param.GetBorthogonalization() >= 1)
136 EPSGDSetBOrth(eps, borth);
139 PetscInt bs = param.GetBlockSize();
141 EPSGDSetBlockSize(eps, bs);
143 if (param.GetDoubleExpansion() >= 0)
145 PetscBool exp = PETSC_FALSE;
146 if (param.GetDoubleExpansion() >= 1)
149 EPSGDSetDoubleExpansion(eps, exp);
152 if (param.GetInitialSize() > 0)
153 EPSGDSetInitialSize(eps, param.GetInitialSize());
155 if (param.GetKrylovRestart() >= 0)
157 PetscBool restart = PETSC_FALSE;
158 if (param.GetKrylovRestart() >= 1)
159 restart = PETSC_TRUE;
161 EPSGDSetKrylovStart(eps, restart);
164 if (param.GetRestartNumber() > 0)
165 EPSGDSetRestart(eps, param.GetRestartNumber(), param.GetRestartNumberAdd());
172 else if (solver == param.JD)
174 if (param.GetBorthogonalization() >= 0)
176 PetscBool borth = PETSC_FALSE;
177 if (param.GetBorthogonalization() >= 1)
180 EPSJDSetBOrth(eps, borth);
183 PetscInt bs = param.GetBlockSize();
185 EPSJDSetBlockSize(eps, bs);
187 if (param.GetInitialSize() > 0)
188 EPSJDSetInitialSize(eps, param.GetInitialSize());
190 if (param.GetKrylovRestart() >= 0)
192 PetscBool restart = PETSC_FALSE;
193 if (param.GetKrylovRestart() >= 1)
194 restart = PETSC_TRUE;
196 EPSJDSetKrylovStart(eps, restart);
199 if (param.GetRestartNumber() > 0)
200 EPSJDSetRestart(eps, param.GetRestartNumber(), param.GetRestartNumberAdd());
207 else if (solver == param.KRYLOVSCHUR)
209 if (param.UseNonLockingVariant())
210 EPSKrylovSchurSetLocking(eps, PETSC_FALSE);
212 EPSKrylovSchurSetLocking(eps, PETSC_TRUE);
214 if (param.GetRestartRatio() > 0)
215 EPSKrylovSchurSetRestart(eps, param.GetRestartRatio());
217 else if (solver == param.LOBPCG)
219 if (param.GetBlockSize() > 0)
220 EPSLOBPCGSetBlockSize(eps, param.GetBlockSize());
222 if (param.UseNonLockingVariant())
223 EPSLOBPCGSetLocking(eps, PETSC_FALSE);
225 EPSLOBPCGSetLocking(eps, PETSC_TRUE);
227 if (param.GetRestartRatio() > 0)
228 EPSLOBPCGSetRestart(eps, param.GetRestartRatio());
230 else if (solver == param.PRIMME)
232 #ifdef SLEPC_HAVE_PRIMME
233 if (param.GetBlockSize() > 0)
234 EPSPRIMMESetBlockSize(eps, param.GetBlockSize());
236 if (param.GetMethod().size() > 1)
238 if (param.GetMethod() ==
"DYNAMIC")
239 EPSPRIMMESetMethod(eps, EPS_PRIMME_DYNAMIC);
240 else if (param.GetMethod() ==
"DEFAULT_MIN_TIME")
241 EPSPRIMMESetMethod(eps, EPS_PRIMME_DEFAULT_MIN_TIME);
242 else if (param.GetMethod() ==
"DEFAULT_MIN_MATVECS")
243 EPSPRIMMESetMethod(eps, EPS_PRIMME_DEFAULT_MIN_MATVECS);
244 else if (param.GetMethod() ==
"ARNOLDI")
245 EPSPRIMMESetMethod(eps, EPS_PRIMME_ARNOLDI);
246 else if (param.GetMethod() ==
"GD")
247 EPSPRIMMESetMethod(eps, EPS_PRIMME_GD);
248 else if (param.GetMethod() ==
"GD_PLUSK")
249 EPSPRIMMESetMethod(eps, EPS_PRIMME_GD_PLUSK);
250 else if (param.GetMethod() ==
"GD_OLSEN_PLUSK")
251 EPSPRIMMESetMethod(eps, EPS_PRIMME_GD_OLSEN_PLUSK);
252 else if (param.GetMethod() ==
"JD_OLSEN_PLUSK")
253 EPSPRIMMESetMethod(eps, EPS_PRIMME_JD_OLSEN_PLUSK);
254 else if (param.GetMethod() ==
"RQI")
255 EPSPRIMMESetMethod(eps, EPS_PRIMME_RQI);
256 else if (param.GetMethod() ==
"JDQR")
257 EPSPRIMMESetMethod(eps, EPS_PRIMME_JDQR);
258 else if (param.GetMethod() ==
"JDQMR")
259 EPSPRIMMESetMethod(eps, EPS_PRIMME_JDQMR);
260 else if (param.GetMethod() ==
"JDQMR_ETOL")
261 EPSPRIMMESetMethod(eps, EPS_PRIMME_JDQMR_ETOL);
262 else if (param.GetMethod() ==
"SUBSPACE_ITERATION")
263 EPSPRIMMESetMethod(eps, EPS_PRIMME_SUBSPACE_ITERATION);
264 else if (param.GetMethod() ==
"LOBPCG_ORTHOBASIS")
265 EPSPRIMMESetMethod(eps, EPS_PRIMME_LOBPCG_ORTHOBASIS);
266 else if (param.GetMethod() ==
"LOBPCG_ORTHOBASISW")
267 EPSPRIMMESetMethod(eps, EPS_PRIMME_LOBPCG_ORTHOBASISW);
270 cout <<
"Slepc not compiled with PRIMME" << endl;
274 else if (solver == param.POWER)
276 if (param.GetShiftType() >= 0)
278 if (param.GetShiftType() == param.SHIFT_CONSTANT)
279 EPSPowerSetShiftType(eps, EPS_POWER_SHIFT_CONSTANT);
280 else if (param.GetShiftType() == param.SHIFT_RAYLEIGH)
281 EPSPowerSetShiftType(eps, EPS_POWER_SHIFT_RAYLEIGH);
282 else if (param.GetShiftType() == param.SHIFT_WILKINSON)
283 EPSPowerSetShiftType(eps, EPS_POWER_SHIFT_WILKINSON);
286 else if (solver == param.RQCG)
288 if (param.GetNumberOfSteps() > 0)
289 EPSRQCGSetReset(eps, param.GetNumberOfSteps());
299 VecGetLocalSize(x, &n);
301 PetscScalar* x_array;
302 VecGetArrayRead(x, (
const PetscScalar**)&x_array);
304 y.SetData(n, x_array);
308 void AllocatePetscVector(
const MPI_Comm& comm, Vec& Vr,
int n,
int nglob,
309 Vector<PetscScalar>& Vr_vec)
311 VecCreate(comm, &Vr);
312 VecSetSizes(Vr, n, nglob);
313 VecSetFromOptions(Vr);
327 MatShellGetContext(mat, &ctx);
352 var_eig.IncrementLinearSolves();
363 var_eig.IncrementLinearSolves();
370 var_eig.IncrementLinearSolves();
389 var_eig.IncrementLinearSolves();
399 cout <<
"Not implemented" << endl;
404 xvec0.Nullify(); yvec.Nullify();
417 MatShellGetContext(mat, &ctx);
425 xvec.Nullify(); yvec.Nullify();
433 throw Undefined(
"Function MatMultTranspose_Matrix not implemented");
441 throw Undefined(
"Function MatGetDiagonal_Matrix not implemented");
447 bool PutEigenpairLapackForm(
int num,
int nev, T& Lr, T& Li, Vector<T>& Vr, Vector<T>& Vi,
448 T& Lr_next, T& Li_next, Vector<T>& Vr_next, Vector<T>& Vi_next,
449 Vector<T>& eigen_values, Vector<T>& lambda_imag,
450 Matrix<T, General, ColMajor>& eigen_vectors)
452 bool eigen_pair =
false;
453 if ((Li != T(0)) && (num < nev-1))
459 eigen_values(num) = Lr;
460 lambda_imag(num) = Li;
461 eigen_values(num+1) = Lr_next;
462 lambda_imag(num+1) = Li_next;
463 for (
int j = 0; j < n; j++)
465 eigen_vectors(j, num) = Vr(j);
466 eigen_vectors(j, num+1) = Vi(j);
471 eigen_values(num) = Lr;
472 lambda_imag(num) = Li;
473 for (
int j = 0; j < n; j++)
474 eigen_vectors(j, num) = Vr(j);
482 bool PutEigenpairLapackForm(
int num,
int nev, complex<T>& Lr, complex<T>& Li,
483 Vector<complex<T> >& Vr, Vector<complex<T> >& Vi,
484 complex<T>& Lr_next, complex<T>& Li_next,
485 Vector<complex<T> >& Vr_next, Vector<complex<T> >& Vi_next,
486 Vector<complex<T> >& eigen_values, Vector<complex<T> >& lambda_imag,
487 Matrix<complex<T>, General, ColMajor>& eigen_vectors)
490 eigen_values(num) = Lr;
491 lambda_imag(num) = Li;
492 for (
int j = 0; j < n; j++)
493 eigen_vectors(j, num) = Vr(j);
499 void FindEigenvaluesSlepc_(EigenProblem_Base<PetscScalar>& var,
500 Vector<PetscScalar>& eigen_values,
501 Vector<PetscScalar>& lambda_imag,
502 Matrix<PetscScalar, General, ColMajor>& eigen_vectors)
505 PetscScalar shiftr = var.GetShiftValue(), shifti = var.GetImagShiftValue();
506 PetscScalar zero, one;
507 SetComplexZero(zero);
510 int print_level = var.GetPrintLevel();
511 SlepcParam& param = var.GetSlepcParameters();
512 int rank_proc; MPI_Comm_rank(var.GetCommunicator(), &rank_proc);
515 int nev = var.GetNbAskedEigenvalues();
516 int ncv = var.GetNbArnoldiVectors();
518 int nglob = var.GetGlobalM();
521 MatCreateShell(var.GetCommunicator(), n, n, nglob, nglob,
522 reinterpret_cast<void*
>(&var), &stiff);
524 MatCreateShell(var.GetCommunicator(), n, n, nglob, nglob,
525 reinterpret_cast<void*
>(&var), &mass);
528 MatShellSetOperation(stiff, MATOP_MULT, (
void(*)())
MatMult_Matrix);
536 EPSCreate(var.GetCommunicator(), &eps);
537 SetParametersSlepc(param, eps);
540 bool generalized =
true;
541 bool isherm = var.IsHermitianProblem();
542 if (var.DiagonalMass() || var.UseCholeskyFactoForMass())
544 else if (var.GetComputationalMode() == var.INVERT_MODE)
551 EPSSetOperators(eps, stiff, mass);
553 EPSSetOperators(eps, stiff, NULL);
558 EPSSetProblemType(eps, EPS_GHEP);
560 EPSSetProblemType(eps, EPS_HEP);
565 EPSSetProblemType(eps, EPS_PGNHEP);
567 EPSSetProblemType(eps, EPS_NHEP);
570 EPSWhich which(EPS_LARGEST_MAGNITUDE);
571 switch (var.GetTypeSorting())
573 case EigenProblem_Base<PetscScalar>::SORTED_REAL : which = EPS_LARGEST_REAL;
break;
574 case EigenProblem_Base<PetscScalar>::SORTED_IMAG : which = EPS_LARGEST_IMAGINARY;
break;
575 case EigenProblem_Base<PetscScalar>::SORTED_MODULUS : which = EPS_LARGEST_MAGNITUDE;
break;
576 case EigenProblem_Base<PetscScalar>::SORTED_USER : which = EPS_WHICH_USER;
break;
579 if (var.GetTypeSpectrum() == var.SMALL_EIGENVALUES)
581 switch (var.GetTypeSorting())
583 case EigenProblem_Base<PetscScalar>::SORTED_REAL : which = EPS_SMALLEST_REAL;
break;
584 case EigenProblem_Base<PetscScalar>::SORTED_IMAG : which = EPS_SMALLEST_IMAGINARY;
break;
585 case EigenProblem_Base<PetscScalar>::SORTED_MODULUS : which = EPS_SMALLEST_MAGNITUDE;
break;
589 if ((var.GetComputationalMode() == var.REGULAR_MODE) &&
590 (var.GetTypeSpectrum() == var.CENTERED_EIGENVALUES))
592 PetscScalar target = shiftr;
593 switch (var.GetTypeSorting())
595 case EigenProblem_Base<PetscScalar>::SORTED_REAL : which = EPS_TARGET_REAL;
break;
596 case EigenProblem_Base<PetscScalar>::SORTED_IMAG : which = EPS_TARGET_IMAGINARY; target = shifti;
break;
597 case EigenProblem_Base<PetscScalar>::SORTED_MODULUS : which = EPS_TARGET_MAGNITUDE;
break;
600 EPSSetTarget(eps, target);
603 EPSSetWhichEigenpairs(eps, which);
604 if (which == EPS_WHICH_USER)
605 EPSSetEigenvalueComparison(eps, &EigenProblem_Base<PetscScalar>::GetComparisonEigenvalueSlepc, &var);
607 double tol = var.GetStoppingCriterion();
608 int nb_max_iter = var.GetNbMaximumIterations();
609 EPSSetTolerances(eps, tol, nb_max_iter);
610 EPSSetDimensions(eps, nev, ncv, PETSC_DEFAULT);
611 EPSSetFromOptions(eps);
614 if (var.DiagonalMass() || var.UseCholeskyFactoForMass())
616 if (var.DiagonalMass())
619 var.ComputeDiagonalMass();
622 var.FactorizeDiagonalMass();
627 var.ComputeMassForCholesky();
630 var.FactorizeCholeskyMass();
633 if (var.GetComputationalMode() != var.REGULAR_MODE)
634 var.ComputeAndFactorizeStiffnessMatrix(-shiftr, one);
638 if (var.GetComputationalMode() == var.INVERT_MODE)
640 if (var.GetTypeSpectrum() != var.CENTERED_EIGENVALUES)
643 var.ComputeAndFactorizeStiffnessMatrix(one, zero);
646 var.ComputeStiffnessMatrix();
651 var.ComputeAndFactorizeStiffnessMatrix(-shiftr, one);
654 var.ComputeMassMatrix();
657 else if (var.GetComputationalMode() == var.REGULAR_MODE)
660 var.ComputeAndFactorizeStiffnessMatrix(one, zero);
663 var.ComputeStiffnessMatrix();
664 var.ComputeMassMatrix();
666 cout <<
"Case not implemented" << endl;
671 cout <<
"Case not implemented" << endl;
677 int ierr = EPSSolve(eps);
680 cout <<
"Error during solution of eigensystem = " << ierr << endl;
684 if (print_level >= 2)
686 PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC_VIEWER_ASCII_INFO_DETAIL);
687 EPSErrorView(eps, EPS_ERROR_RELATIVE, PETSC_VIEWER_STDOUT_WORLD);
688 PetscViewerPopFormat(PETSC_VIEWER_STDOUT_WORLD);
691 EPSConvergedReason reason;
692 EPSGetConvergedReason(eps, &reason);
696 cout <<
"The solver did not converge" << endl;
698 if (reason == EPS_DIVERGED_ITS)
699 throw SolverMaximumIterationError(
"FindEigenvaluesSlepc",
"Maximum number of iterations reached");
701 throw SolverDivergenceError(
"FindEigenvaluesSlepc",
"The solver diverged");
705 Vec Vr, Vi, Vr_next, Vi_next;
706 Vector<PetscScalar> Vr_vec, Vi_vec, Vr_vec_next, Vi_vec_next;
707 AllocatePetscVector(var.GetCommunicator(), Vr, n, nglob, Vr_vec);
708 AllocatePetscVector(var.GetCommunicator(), Vi, n, nglob, Vi_vec);
709 AllocatePetscVector(var.GetCommunicator(), Vr_next, n, nglob, Vr_vec_next);
710 AllocatePetscVector(var.GetCommunicator(), Vi_next, n, nglob, Vi_vec_next);
712 eigen_values.Reallocate(nev);
713 lambda_imag.Reallocate(nev);
714 eigen_vectors.Reallocate(n, nev);
716 PetscScalar Lr, Li, Lr_next, Li_next;
717 bool eigen_pair =
true;
721 EPSGetEigenpair(eps, num, &Lr, &Li, Vr, Vi);
724 EPSGetEigenpair(eps, num+1, &Lr_next, &Li_next, Vr_next, Vi_next);
726 eigen_pair = PutEigenpairLapackForm(num, nev, Lr, Li, Vr_vec, Vi_vec,
727 Lr_next, Li_next, Vr_vec_next, Vi_vec_next,
728 eigen_values, lambda_imag, eigen_vectors);
734 Lr = Lr_next; Li = Li_next;
735 Vr_vec = Vr_vec_next; Vi_vec = Vi_vec_next;
742 Vr_vec_next.Nullify();
743 Vi_vec_next.Nullify();
766 void ApplySpectralTransform(
double shift, Vector<double>& eigen_values, Vector<double>& lambda_imag)
768 for (
int i = 0; i < eigen_values.GetM(); i++)
770 if (lambda_imag(i) == 0.0)
771 eigen_values(i) = shift + 1.0/eigen_values(i);
774 complex<double> val(eigen_values(i), lambda_imag(i));
775 complex<double> z = shift + 1.0/val;
776 eigen_values(i) = real(z); lambda_imag(i) = imag(z);
781 void ApplySpectralTransform(complex<double> shift, Vector<complex<double> >& eigen_values, Vector<complex<double> >& lambda_imag)
783 for (
int i = 0; i < eigen_values.GetM(); i++)
784 eigen_values(i) = shift + 1.0/eigen_values(i);
788 void SetParametersSlepc(
const SlepcParamPep& param, PEP& pep)
790 switch(param.GetEigensolverType())
792 case SlepcParamPep::TOAR : PEPSetType(pep, PEPTOAR);
break;
793 case SlepcParamPep::STOAR : PEPSetType(pep, PEPSTOAR);
break;
794 case SlepcParamPep::QARNOLDI : PEPSetType(pep, PEPQARNOLDI);
break;
795 case SlepcParamPep::LINEAR : PEPSetType(pep, PEPLINEAR);
break;
796 case SlepcParamPep::JD : PEPSetType(pep, PEPJD);
break;
814 MatShellGetContext(mat, &ctx);
819 op.var->
MltOperator(op.num_op, SeldonNoTrans, xvec, yvec);
821 xvec.Nullify(); yvec.Nullify();
833 MatShellGetContext(mat, &ctx);
838 op.var->
MltOperator(op.num_op, SeldonTrans, xvec, yvec);
840 xvec.Nullify(); yvec.Nullify();
852 MatShellGetContext(mat, &ctx);
858 op.var->SolveOperator(SeldonNoTrans, xvec, yvec);
860 op.var->
SolveMass(SeldonNoTrans, xvec, yvec);
864 xvec.Nullify(); yvec.Nullify();
871 cout <<
"Not implemented" << endl;
883 PetscScalar zero, one;
884 SetComplexZero(zero);
896 for (
int k = 0; k <= deg_pol; k++)
900 MatCreateShell(var.GetCommunicator(), n, n, nglob, nglob,
901 reinterpret_cast<void*
>(&my_op(k)), &op(k));
909 PEPCreate(var.GetCommunicator(), &solver);
911 PEPSetOperators(solver, deg_pol+1, op.GetData());
912 PEPGetST(solver, &st);
916 STSetMatMode(st, ST_MATMODE_SHELL);
920 PEPWhich which(PEP_LARGEST_MAGNITUDE);
949 PEPSetTarget(solver, shift);
952 PEPSetWhichEigenpairs(solver, which);
953 if (which == PEP_WHICH_USER)
959 PEPSetTolerances(solver, tol, nb_max_iter);
960 PEPSetDimensions(solver, nev, PETSC_DECIDE, PETSC_DECIDE);
969 binom_coef(0, 0) = 1;
970 binom_coef(1, 0) = 1; binom_coef(1, 1) = 1;
971 for (
int n = 2; n <= deg_pol; n++)
973 binom_coef(n, 0) = 1; binom_coef(n, n) = 1;
974 for (
int k = 1; k < n; k++)
975 binom_coef(n, k) = binom_coef(n-1, k-1) + binom_coef(n-1, k);
980 for (
int k = 0; k <= deg_pol; k++)
982 coef.Zero(); PetscScalar pow_shift = 1.0;
983 for (
int j = 0; j <= deg_pol-k; j++)
985 coef(j+k) = double(binom_coef(j+k, k))*pow_shift;
991 var.FactorizeOperator(coef);
995 PEPSetScale(solver, PEP_SCALE_SCALAR, PETSC_DECIDE, PETSC_NULL, PETSC_NULL,
996 PETSC_DECIDE, PETSC_DECIDE);
1002 int ierr = PEPSolve(solver);
1005 cout <<
"Error during solution of eigensystem = " << ierr << endl;
1009 PEPConvergedReason reason;
1010 PEPGetConvergedReason(solver, &reason);
1013 cout <<
"Failed to converged " << reason << endl;
1018 if (print_level >= 4)
1020 PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD,PETSC_VIEWER_ASCII_INFO_DETAIL);
1021 PEPErrorView(solver, PEP_ERROR_RELATIVE, PETSC_VIEWER_STDOUT_WORLD);
1022 PetscViewerPopFormat(PETSC_VIEWER_STDOUT_WORLD);
1026 #ifdef SELDON_WITH_MPI
1027 MPI_Comm_rank(var.GetCommunicator(), &rank_proc);
1030 if ((print_level >= 1) && (rank_proc == 0))
1034 Vec Vr, Vi, Vr_next, Vi_next;
1036 AllocatePetscVector(var.GetCommunicator(), Vr, n, nglob, Vr_vec);
1037 AllocatePetscVector(var.GetCommunicator(), Vi, n, nglob, Vi_vec);
1038 AllocatePetscVector(var.GetCommunicator(), Vr_next, n, nglob, Vr_vec_next);
1039 AllocatePetscVector(var.GetCommunicator(), Vi_next, n, nglob, Vi_vec_next);
1041 eigen_values.Reallocate(nev);
1042 lambda_imag.Reallocate(nev);
1043 eigen_vectors.Reallocate(n, nev);
1045 PetscScalar Lr, Li, Lr_next, Li_next;
1046 bool eigen_pair =
true;
1050 PEPGetEigenpair(solver, num, &Lr, &Li, Vr, Vi);
1053 PEPGetEigenpair(solver, num+1, &Lr_next, &Li_next, Vr_next, Vi_next);
1055 eigen_pair = PutEigenpairLapackForm(num, nev, Lr, Li, Vr_vec, Vi_vec,
1056 Lr_next, Li_next, Vr_vec_next, Vi_vec_next,
1057 eigen_values, lambda_imag, eigen_vectors);
1063 Lr = Lr_next; Li = Li_next;
1064 Vr_vec = Vr_vec_next; Vi_vec = Vi_vec_next;
1071 Vr_vec_next.Nullify();
1072 Vi_vec_next.Nullify();
1075 ApplySpectralTransform(shift, eigen_values, lambda_imag);
1080 PEPDestroy(&solver);
1081 for (
int k = 0; k <= deg_pol; k++)
1099 NonLinearEigenProblem_Base<PetscScalar>* var;
1102 { jacobian =
false; num_operator = -1; var = NULL; SetComplexZero(L); }
1110 NonLinearEigenProblem_Base<PetscScalar>* var;
1116 { SetComplexZero(L); type_solver = 0; }
1124 PCShellGetContext(pc, (
void**)&shell);
1127 PCGetOperators(pc, &Amat, &Pmat);
1130 MatGetType(Amat, &type);
1132 if (strcmp(type,MATSHELL) == 0)
1136 MatShellGetContext(Amat, &ctxF);
1139 if (shell->type_solver == SlepcParamNep::NLEIGS)
1147 for (
int i = 0; i < ctx->nmat; i++)
1149 MatShellGetContext(ctx->A[i], &ctxF);
1154 L(i) = op.L; coef(i) = ctx->coeff[i];
1155 numL(i) = op.num_operator;
1156 shell->var->CheckValueL(L(i));
1160 bool new_coef =
false;
1161 if (ctx->nmat != shell->Ltab.GetM())
1165 for (
int i = 0; i < ctx->nmat; i++)
1166 if ((abs(shell->Ltab(i) - L(i)) > 1e-12) || (abs(shell->coef_tab(i) - coef(i)) > 1e-12) || (shell->numL_tab(i) != numL(i)))
1171 if (new_coef || first_construct)
1174 shell->Ltab = L; shell->coef_tab = coef; shell->numL_tab = numL;
1175 if (shell->var->UseSplitMatrices())
1176 shell->var->ComputeSplitPreconditioning(numL, coef);
1178 shell->var->ComputePreconditioning(L, coef);
1188 shell->var->CheckValueL(L);
1192 if ((abs(L - shell->L) >= 1e-12) || first_construct)
1195 shell->var->ComputePreconditioning(L);
1203 MatGetSize(Amat, &m, &n);
1205 Mat_SeqAIJ* A = (Mat_SeqAIJ*) Amat->data;
1211 for (
int i = 0; i < m; i++)
1213 int nz = A->i[i+1] - A->i[i];
1214 Ad.ReallocateRow(i, nz);
1215 for (
int j = 0; j < nz; j++)
1217 Ad.Index(i, j) = A->j[A->i[i]+j];
1218 Ad.Value(i, j) = A->a[A->i[i]+j];
1223 shell->var->ComputeExplicitPreconditioning(Ad);
1228 PetscErrorCode ConstructPreconditioning_NepOperator(PC pc)
1236 PetscErrorCode UpdatePreconditioning_NepOperator(PC pc, KSP ksp, Vec b, Vec x)
1243 PetscErrorCode ApplyPreconditioning_NepOperator(PC pc, Vec x, Vec y)
1245 Vector<PetscScalar> xvec, yvec;
1249 NepSlepcPreconditioning* shell;
1251 PCShellGetContext(pc, (
void**)&shell);
1252 shell->var->IncrementLinearSolves();
1253 shell->var->ApplyPreconditioning(SeldonNoTrans, xvec, yvec);
1255 xvec.Nullify(); yvec.Nullify();
1260 PetscErrorCode SetSingularities_NepOperator(NEP nep, PetscInt *maxnp,
1261 PetscScalar *xi,
void *ctx)
1263 NonLinearEigenProblem_Base<PetscScalar>& var
1264 = *
reinterpret_cast<NonLinearEigenProblem_Base<PetscScalar>*
>(ctx);
1266 const Vector<PetscScalar>& s = var.GetSingularities();
1267 *maxnp = min(*maxnp, PetscInt(s.GetM()));
1268 for (
int k = 0; k < *maxnp; k++)
1275 void SetParametersSlepc(
const SlepcParamNep& param, NEP& nep,
1276 NonLinearEigenProblem_Base<PetscScalar>& var,
1277 NepSlepcPreconditioning& prec)
1279 switch(param.GetEigensolverType())
1281 case SlepcParamNep::RII : NEPSetType(nep, NEPRII);
break;
1282 case SlepcParamNep::SLP : NEPSetType(nep, NEPSLP);
break;
1283 case SlepcParamNep::NARNOLDI : NEPSetType(nep, NEPNARNOLDI);
break;
1284 case SlepcParamNep::CISS : NEPSetType(nep, NEPCISS);
break;
1285 case SlepcParamNep::INTERPOL : NEPSetType(nep, NEPINTERPOL);
break;
1286 case SlepcParamNep::NLEIGS : NEPSetType(nep, NEPNLEIGS);
break;
1289 KSP ksp; PC pc;
bool precond =
false;
1290 if (param.GetEigensolverType() == SlepcParamNep::RII)
1293 NEPRIISetLagPreconditioner(nep, 0);
1294 NEPRIIGetKSP(nep, &ksp);
1295 if (var.IsHermitianProblem())
1296 NEPRIISetHermitian(nep, PETSC_TRUE);
1298 else if (param.GetEigensolverType() == SlepcParamNep::SLP)
1301 NEPSLPGetKSP(nep, &ksp);
1303 else if (param.GetEigensolverType() == SlepcParamNep::NARNOLDI)
1306 NEPNArnoldiSetLagPreconditioner(nep, 0);
1307 NEPNArnoldiGetKSP(nep, &ksp);
1308 NEPNArnoldiSetLagPreconditioner(nep, 0);
1310 else if (param.GetEigensolverType() == SlepcParamNep::NLEIGS)
1313 if (!var.UseSplitMatrices())
1314 NEPNLEIGSSetSingularitiesFunction(nep, SetSingularities_NepOperator,
reinterpret_cast<void*
>(&var));
1316 if (param.GetRKShifts().GetM() > 0)
1318 int ns = param.GetRKShifts().GetM();
1319 PetscScalar shifts[ns];
1320 for (
int k = 0; k < ns; k++)
1321 shifts[k] = param.GetRKShifts()(k);
1323 NEPNLEIGSSetRKShifts(nep, ns, shifts);
1326 int nsolve; KSP* vec_ksp;
1327 NEPNLEIGSGetKSPs(nep, &nsolve, &vec_ksp);
1331 cout <<
"Too many solves required in nleigs = " << nsolve << endl;
1332 cout <<
"Not implemented" << endl;
1338 RGSetType(rg, RGINTERVAL);
1339 RGIntervalSetEndpoints(rg, param.GetLrMin(), param.GetLrMax(),
1340 param.GetLiMin(), param.GetLiMax());
1342 if (!param.InsideRegion(var.GetShiftValue()))
1344 cout <<
"Target " << var.GetShiftValue() <<
" not inside the region"
1345 <<
" [ " << param.GetLrMin() <<
", " << param.GetLrMax() <<
"] x ["
1346 << param.GetLiMin() <<
", " << param.GetLiMax() <<
"]" << endl;
1351 if (param.FullBasis())
1352 NEPNLEIGSSetFullBasis(nep, PETSC_TRUE);
1354 NEPNLEIGSSetFullBasis(nep, PETSC_FALSE);
1356 if (param.LockingVariant())
1357 NEPNLEIGSSetLocking(nep, PETSC_TRUE);
1359 NEPNLEIGSSetLocking(nep, PETSC_FALSE);
1361 NEPNLEIGSSetRestart(nep, param.GetRestartNleigs());
1363 if ((param.GetInterpolationDegree() >= 0) && (param.GetInterpolationTolerance() > 0))
1364 NEPNLEIGSSetInterpolation(nep, param.GetInterpolationTolerance(),
1365 param.GetInterpolationDegree());
1369 cout <<
"Solver " << param.GetEigensolverType() <<
" not interfaced in nep" << endl;
1373 if (var.ExplicitMatrix() && param.UseDefaultPetscSolver())
1378 prec.type_solver = param.GetEigensolverType();
1380 if (var.ExactPreconditioning())
1381 KSPSetType(ksp, KSPPREONLY);
1383 KSPSetType(ksp, KSPBCGS);
1386 PCSetType(pc, PCSHELL);
1387 PCShellSetContext(pc,
reinterpret_cast<void*
>(&prec));
1388 PCShellSetApply(pc, ApplyPreconditioning_NepOperator);
1390 PCShellSetPreSolve(pc, UpdatePreconditioning_NepOperator);
1394 if (param.UseCommandLineOptions())
1395 NEPSetFromOptions(nep);
1399 PetscErrorCode FormFunctionNEP(NEP nep, PetscScalar lambda, Mat A, Mat B,
void* ctx)
1402 MatShellGetContext(A, &ctxF);
1404 NepSlepcOperator& op
1405 = *
reinterpret_cast<NepSlepcOperator*
>(ctxF);
1408 op.var->CheckValueL(lambda);
1409 op.var->ComputeOperator(op.L);
1415 PetscErrorCode FormJacobianNEP(NEP nep, PetscScalar lambda, Mat A,
void* ctx)
1418 MatShellGetContext(A, &ctxF);
1420 NepSlepcOperator& op
1421 = *
reinterpret_cast<NepSlepcOperator*
>(ctxF);
1424 op.var->CheckValueL(lambda);
1425 op.var->ComputeJacobian(op.L);
1431 void ConvertToPetsc(DistributedMatrix<PetscScalar, General, ArrayRowSparse>& A, Mat Ap)
1433 Vector<int> nnz(A.GetM());
1434 for (
int i = 0; i < A.GetM(); i++)
1435 nnz(i) = A.GetRowSize(i);
1437 MatSeqAIJSetPreallocation(Ap, PETSC_DEFAULT, nnz.GetData());
1440 for (
int i = 0; i < A.GetM(); i++)
1441 MatSetValues(Ap, 1, &i, A.GetRowSize(i), A.GetIndex(i), A.GetData(i), INSERT_VALUES);
1443 MatAssemblyBegin(Ap, MAT_FINAL_ASSEMBLY);
1444 MatAssemblyEnd(Ap, MAT_FINAL_ASSEMBLY);
1448 PetscErrorCode FormFunctionExpNEP(NEP nep, PetscScalar lambda, Mat Ap, Mat Bp,
void* ctx)
1450 NepSlepcOperator& op
1451 = *
reinterpret_cast<NepSlepcOperator*
>(ctx);
1453 DistributedMatrix<PetscScalar, General, ArrayRowSparse> A;
1454 op.var->CheckValueL(lambda);
1455 op.var->ComputeOperatorExplicit(lambda, A);
1457 ConvertToPetsc(A, Ap);
1463 PetscErrorCode FormJacobianExpNEP(NEP nep, PetscScalar lambda, Mat Ap,
void* ctx)
1465 NepSlepcOperator& op
1466 = *
reinterpret_cast<NepSlepcOperator*
>(ctx);
1468 DistributedMatrix<PetscScalar, General, ArrayRowSparse> A;
1469 op.var->CheckValueL(lambda);
1470 op.var->ComputeJacobianExplicit(lambda, A);
1472 ConvertToPetsc(A, Ap);
1485 MatShellGetContext(mat, &ctx);
1490 if (op.num_operator == -1)
1492 op.var->CheckValueL(op.L);
1493 op.var->IncrementProdMatVect();
1495 op.var->MltJacobian(op.L, SeldonNoTrans, xvec, yvec);
1497 op.var->MltOperator(op.L, SeldonNoTrans, xvec, yvec);
1501 op.var->IncrementProdMatVect();
1502 op.var->MltOperatorSplit(op.num_operator, SeldonNoTrans, xvec, yvec);
1505 xvec.Nullify(); yvec.Nullify();
1517 MatShellGetContext(mat, &ctx);
1522 if (op.num_operator == -1)
1524 op.var->IncrementProdMatVect();
1525 op.var->CheckValueL(op.L);
1527 op.var->MltJacobian(op.L, SeldonTrans, xvec, yvec);
1529 op.var->MltOperator(op.L, SeldonTrans, xvec, yvec);
1533 op.var->MltOperatorSplit(op.num_operator, SeldonTrans, xvec, yvec);
1534 op.var->IncrementProdMatVect();
1537 xvec.Nullify(); yvec.Nullify();
1542 PetscErrorCode MatDuplicate_NepOperator(Mat A, MatDuplicateOption op, Mat* B)
1544 NepSlepcOperator *actx,*bctx;
1548 MatShellGetContext(A, (
void**)&actx);
1549 MatGetLocalSize(A, &nloc, NULL);
1550 MatGetSize(A, &n, NULL);
1552 bctx =
new NepSlepcOperator;
1553 bctx->jacobian = actx->jacobian;
1555 bctx->var = actx->var;
1556 bctx->num_operator = actx->num_operator;
1558 PetscObjectGetComm((PetscObject)A, &comm);
1559 MatCreateShell(comm, nloc, nloc, n, n,(
void*)bctx, B);
1562 MatShellSetOperation(*B, MATOP_DUPLICATE, (
void(*)(
void))MatDuplicate_NepOperator);
1568 void FindEigenvaluesSlepc_(NonLinearEigenProblem_Base<PetscScalar>& var,
1574 PetscScalar shift = var.GetShiftValue();
1575 PetscScalar zero, one;
1576 SetComplexZero(zero);
1580 int nev = var.GetNbAskedEigenvalues();
1582 int nglob = var.GetGlobalM();
1586 NEPCreate(var.GetCommunicator(), &solver);
1589 Mat EvalF, EvalJacob;
1591 operT.jacobian =
false; operT.var = &var;
1593 operTp.jacobian =
true; operTp.var = &var;
1597 Vector<Mat> EvalF_Split(var.GetNbSplitMatrices());
1599 Vector<FN> FunctionF_Split(var.GetNbSplitMatrices());
1601 if (var.UseSplitMatrices())
1603 if (var.ExplicitMatrix())
1605 for (
int i = 0; i < var.GetNbSplitMatrices(); i++)
1607 MatCreate(var.GetCommunicator(), &EvalF_Split(i));
1608 MatSetSizes(EvalF_Split(i), n, n, nglob, nglob);
1609 MatSetType(EvalF_Split(i), MATSEQAIJ);
1612 var.ComputeOperatorSplitExplicit(i, A);
1614 ConvertToPetsc(A, EvalF_Split(i));
1619 for (
int i = 0; i < var.GetNbSplitMatrices(); i++)
1621 operSplit(i).jacobian =
false; operSplit(i).var = &var;
1622 operSplit(i).num_operator = i;
1623 MatCreateShell(var.GetCommunicator(), n, n, nglob, nglob,
1624 reinterpret_cast<void*
>(&operSplit(i)), &EvalF_Split(i));
1628 MatShellSetOperation(EvalF_Split(i), MATOP_DUPLICATE, (
void(*)(
void))MatDuplicate_NepOperator);
1632 for (
int i = 0; i < var.GetNbSplitMatrices(); i++)
1636 FNCreate(var.GetCommunicator(), &FunctionF_Split(i));
1637 FNSetType(FunctionF_Split(i), FNRATIONAL);
1638 FNRationalSetNumerator(FunctionF_Split(i), P.GetM(), P.GetData());
1639 FNRationalSetDenominator(FunctionF_Split(i), Q.GetM(), Q.GetData());
1642 NEPSetProblemType(solver, NEP_RATIONAL);
1643 NEPSetSplitOperator(solver, var.GetNbSplitMatrices(), EvalF_Split.GetData(),
1644 FunctionF_Split.GetData(), DIFFERENT_NONZERO_PATTERN);
1648 if (var.ExplicitMatrix())
1650 MatCreate(var.GetCommunicator(), &EvalF);
1651 MatSetSizes(EvalF, n, n, nglob, nglob);
1652 MatSetType(EvalF, MATSEQAIJ);
1657 MatCreateShell(var.GetCommunicator(), n, n, nglob, nglob,
1658 reinterpret_cast<void*
>(&operT), &EvalF);
1662 MatShellSetOperation(EvalF, MATOP_DUPLICATE, (
void(*)(
void))MatDuplicate_NepOperator);
1665 if (var.ExplicitMatrix())
1667 MatCreate(var.GetCommunicator(), &EvalJacob);
1668 MatSetSizes(EvalJacob, n, n, nglob, nglob);
1669 MatSetType(EvalJacob, MATSEQAIJ);
1670 MatSetUp(EvalJacob);
1674 MatCreateShell(var.GetCommunicator(), n, n, nglob, nglob,
1675 reinterpret_cast<void*
>(&operTp), &EvalJacob);
1679 MatShellSetOperation(EvalJacob, MATOP_DUPLICATE, (
void(*)(
void))MatDuplicate_NepOperator);
1682 if (var.ExplicitMatrix())
1683 NEPSetFunction(solver, EvalF, EvalF, FormFunctionExpNEP,
reinterpret_cast<void*
>(&operT));
1685 NEPSetFunction(solver, EvalF, EvalF, FormFunctionNEP, NULL);
1687 if (var.ExplicitMatrix())
1688 NEPSetJacobian(solver, EvalJacob, FormJacobianExpNEP,
reinterpret_cast<void*
>(&operTp));
1690 NEPSetJacobian(solver, EvalJacob, FormJacobianNEP, NULL);
1694 NEPWhich which(NEP_LARGEST_MAGNITUDE);
1695 switch (var.GetTypeSorting())
1697 case NonLinearEigenProblem_Base<PetscScalar>::SORTED_REAL : which = NEP_LARGEST_REAL;
break;
1698 case NonLinearEigenProblem_Base<PetscScalar>::SORTED_IMAG : which = NEP_LARGEST_IMAGINARY;
break;
1699 case NonLinearEigenProblem_Base<PetscScalar>::SORTED_MODULUS : which = NEP_LARGEST_MAGNITUDE;
break;
1700 case NonLinearEigenProblem_Base<PetscScalar>::SORTED_USER : which = NEP_WHICH_USER;
break;
1703 if (var.GetTypeSpectrum() == var.SMALL_EIGENVALUES)
1705 switch (var.GetTypeSorting())
1707 case NonLinearEigenProblem_Base<PetscScalar>::SORTED_REAL : which = NEP_SMALLEST_REAL;
break;
1708 case NonLinearEigenProblem_Base<PetscScalar>::SORTED_IMAG : which = NEP_SMALLEST_IMAGINARY;
break;
1709 case NonLinearEigenProblem_Base<PetscScalar>::SORTED_MODULUS : which = NEP_SMALLEST_MAGNITUDE;
break;
1713 if (var.GetTypeSpectrum() == var.CENTERED_EIGENVALUES)
1715 switch (var.GetTypeSorting())
1717 case NonLinearEigenProblem_Base<PetscScalar>::SORTED_REAL : which = NEP_TARGET_REAL;
break;
1718 case NonLinearEigenProblem_Base<PetscScalar>::SORTED_IMAG : which = NEP_TARGET_IMAGINARY;
break;
1719 case NonLinearEigenProblem_Base<PetscScalar>::SORTED_MODULUS : which = NEP_TARGET_MAGNITUDE;
break;
1722 NEPSetTarget(solver, shift);
1725 NEPSetWhichEigenpairs(solver, which);
1726 if (which == NEP_WHICH_USER)
1727 NEPSetEigenvalueComparison(solver, &NonLinearEigenProblem_Base<PetscScalar>::GetComparisonEigenvalueSlepc, &var);
1730 double tol = var.GetStoppingCriterion();
1731 int nb_max_iter = var.GetNbMaximumIterations();
1732 NEPSetTolerances(solver, tol, nb_max_iter);
1733 int ncv = PETSC_DEFAULT;
1734 if (var.GetNbArnoldiVectors() > 0)
1735 ncv = var.GetNbArnoldiVectors();
1738 NEPSetDimensions(solver, nev, ncv, PETSC_DEFAULT);
1742 SetParametersSlepc(var.GetSlepcParameters(), solver, var, prec);
1745 PetscErrorCode ierr = NEPSolve(solver);
1748 cout <<
"Error during solution of eigensystem = " << ierr << endl;
1752 int print_level = var.GetPrintLevel();
1753 if (print_level >= 4)
1755 PetscViewerPushFormat(PETSC_VIEWER_STDOUT_WORLD, PETSC_VIEWER_ASCII_INFO_DETAIL);
1756 NEPConvergedReasonView(solver, PETSC_VIEWER_STDOUT_WORLD);
1757 NEPErrorView(solver, NEP_ERROR_RELATIVE, PETSC_VIEWER_STDOUT_WORLD);
1758 PetscViewerPopFormat(PETSC_VIEWER_STDOUT_WORLD);
1762 NEPGetConverged(solver, &nev);
1765 Vec Vr, Vi, Vr_next, Vi_next;
1767 AllocatePetscVector(var.GetCommunicator(), Vr, n, nglob, Vr_vec);
1768 AllocatePetscVector(var.GetCommunicator(), Vi, n, nglob, Vi_vec);
1769 AllocatePetscVector(var.GetCommunicator(), Vr_next, n, nglob, Vr_vec_next);
1770 AllocatePetscVector(var.GetCommunicator(), Vi_next, n, nglob, Vi_vec_next);
1772 eigen_values.Reallocate(nev);
1773 lambda_imag.Reallocate(nev);
1774 eigen_vectors.Reallocate(n, nev);
1776 PetscScalar Lr, Li, Lr_next, Li_next;
1777 bool eigen_pair =
true;
1781 NEPGetEigenpair(solver, num, &Lr, &Li, Vr, Vi);
1784 NEPGetEigenpair(solver, num+1, &Lr_next, &Li_next, Vr_next, Vi_next);
1786 eigen_pair = PutEigenpairLapackForm(num, nev, Lr, Li, Vr_vec, Vi_vec,
1787 Lr_next, Li_next, Vr_vec_next, Vi_vec_next,
1788 eigen_values, lambda_imag, eigen_vectors);
1794 Lr = Lr_next; Li = Li_next;
1795 Vr_vec = Vr_vec_next; Vi_vec = Vi_vec_next;
1802 Vr_vec_next.Nullify();
1803 Vi_vec_next.Nullify();
1808 NEPDestroy(&solver);
1809 if (var.UseSplitMatrices())
1811 for (
int i = 0; i < var.GetNbSplitMatrices(); i++)
1813 MatDestroy(&EvalF_Split(i));
1814 FNDestroy(&FunctionF_Split(i));
1820 MatDestroy(&EvalJacob);
1823 var.DistributeEigenvectors(eigen_vectors);
1826 #ifdef SELDON_WITH_VIRTUAL
1827 void FindEigenvaluesSlepc(EigenProblem_Base<PetscScalar>& var,
1828 Vector<PetscScalar>& eigen_values,
1829 Vector<PetscScalar>& lambda_imag,
1830 Matrix<PetscScalar, General, ColMajor>& eigen_vectors)
1832 FindEigenvaluesSlepc_(var, eigen_values, lambda_imag, eigen_vectors);
1835 void FindEigenvaluesSlepc(PolynomialEigenProblem_Base<Petsc_Scalar>& var,
1836 Vector<Petsc_Scalar>& eigen_values,
1837 Vector<Petsc_Scalar>& lambda_imag,
1838 Matrix<Petsc_Scalar, General, ColMajor>& eigen_vectors)
1840 FindEigenvaluesSlepc_(var, eigen_values, lambda_imag, eigen_vectors);
1843 void FindEigenvaluesSlepc(NonLinearEigenProblem_Base<Petsc_Scalar>& var,
1844 Vector<Petsc_Scalar>& eigen_values,
1845 Vector<Petsc_Scalar>& lambda_imag,
1846 Matrix<Petsc_Scalar, General, ColMajor>& eigen_vectors)
1848 FindEigenvaluesSlepc_(var, eigen_values, lambda_imag, eigen_vectors);
1851 template<
class EigenProblem,
class T,
class Allocator1,
1852 class Allocator2,
class Allocator3>
1853 void FindEigenvaluesSlepc(EigenProblem& var,
1854 Vector<T, VectFull, Allocator1>& eigen_values,
1855 Vector<T, VectFull, Allocator2>& lambda_imag,
1856 Matrix<T, General, ColMajor, Allocator3>& eigen_vectors)
1858 cout <<
"Recompile with SELDON_WITH_VIRTUAL" << endl;
1865 #define SELDON_FILE_SLEPC_HXX