|
@@ -237,8 +237,10 @@ namespace Lemma {
|
237
|
237
|
// << " in " << iter_done << " iterations"
|
238
|
238
|
//<< " with error " << errorn << "\t"
|
239
|
239
|
<< "\tInital solution error="<< Error.norm() // Iteritive info
|
240
|
|
- << "\tSolver reported error="<< CSolver[iw].error() // Iteritive info
|
241
|
|
- << "\ttime " << timer.end() / 60. << " [m] " << CSolver[iw].iterations() << " iterations" << std::endl;
|
|
240
|
+// << "\tSolver reported error="<< CSolver[iw].error() // Iteritive info
|
|
241
|
+ << "\ttime " << timer.end() / 60. << " [m] "
|
|
242
|
+// << CSolver[iw].iterations() << " iterations"
|
|
243
|
+ << std::endl;
|
242
|
244
|
|
243
|
245
|
//VectorXcr ADivMAC = ADiv.array() * MAC.array().cast<Complex>();
|
244
|
246
|
//logio << "|| Div(A) || on MAC grid " << ADivMAC.norm() << std::endl;
|
|
@@ -393,7 +395,9 @@ namespace Lemma {
|
393
|
395
|
timer.begin();
|
394
|
396
|
|
395
|
397
|
CSolver[iw].isSymmetric(true);
|
396
|
|
- CSolver[iw].setPivotThreshold(0.0);
|
|
398
|
+ //CSolver[iw].setPivotThreshold(0.0); // OK for symmetric complex systems with real and imaginary positive definite parts.
|
|
399
|
+ // // but our imaginary part is negative definite
|
|
400
|
+ //http://www.ams.org/journals/mcom/1998-67-224/S0025-5718-98-00978-8/S0025-5718-98-00978-8.pdf
|
397
|
401
|
|
398
|
402
|
/* Complex system */
|
399
|
403
|
std::cout << "SparseLU pattern analyzing C_" << iw << ",";
|
|
@@ -581,6 +585,27 @@ namespace Lemma {
|
581
|
585
|
}
|
582
|
586
|
}
|
583
|
587
|
|
|
588
|
+ template<>
|
|
589
|
+ void EMSchur3D< Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower, Eigen::IncompleteCholesky<Complex> > > ::BuildCDirectSolver() {
|
|
590
|
+ CSolver = new Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower, Eigen::IncompleteCholesky<Complex> > [Omegas.size()];
|
|
591
|
+ for (int iw=0; iw<Omegas.size(); ++iw) {
|
|
592
|
+ //Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
|
|
593
|
+ jsw_timer timer;
|
|
594
|
+ timer.begin();
|
|
595
|
+ /* Complex system */
|
|
596
|
+ std::cout << "ConjugateGradient<IncompleteCholesky> pattern analyzing C_" << iw << ",";
|
|
597
|
+ std::cout.flush();
|
|
598
|
+ CSolver[iw].analyzePattern( Cvec[iw] );
|
|
599
|
+ std::cout << " done in " << timer.end() / 60. << " [m]" << std::endl;
|
|
600
|
+ // factorize
|
|
601
|
+ timer.begin();
|
|
602
|
+ std::cout << "ConjugateGradient<IncompleteCholesky> factorising C_" << iw << ", ";
|
|
603
|
+ std::cout.flush();
|
|
604
|
+ CSolver[iw].factorize( Cvec[iw] );
|
|
605
|
+ std::cout << " done in " << timer.end() / 60. << " [m]" << std::endl;
|
|
606
|
+ }
|
|
607
|
+ }
|
|
608
|
+
|
584
|
609
|
// template<>
|
585
|
610
|
// void EMSchur3D< Eigen::PastixLLT<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > > ::BuildCDirectSolver() {
|
586
|
611
|
// CSolver = new Eigen::PastixLLT<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > [Omegas.size()];
|