Browse Source

ColMajor

master
Trevor Irons 5 years ago
parent
commit
ffe60de02b
6 changed files with 65 additions and 55 deletions
  1. 6
    6
      examples/EMSchur3D-vtk.cpp
  2. 1
    1
      examples/EMSchur3D.cpp
  3. 49
    39
      include/EMSchur3D.h
  4. 4
    4
      include/EMSchur3DBase.h
  5. 4
    4
      include/bicgstab.h
  6. 1
    1
      src/EMSchur3DBase.cpp

+ 6
- 6
examples/EMSchur3D-vtk.cpp View File

@@ -114,18 +114,18 @@ int main( int argc, char** argv ) {
114 114
     // And solve
115 115
 
116 116
     // Use BiCGSTAB Diagonal preconditioner
117
-    //auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::IncompleteLUT<Complex> > >::NewSP();
118
-    //auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::RowMajor> > >::NewSP();
117
+    auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::IncompleteLUT<Complex> > >::NewSP();
118
+    //auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::ColMajor> > >::NewSP();
119 119
 
120 120
     // LS CG
121
-    //auto EM3D = EMSchur3D< Eigen::LeastSquaresConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::RowMajor> > >::NewSP();
121
+    //auto EM3D = EMSchur3D< Eigen::LeastSquaresConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::ColMajor> > >::NewSP();
122 122
 
123 123
     // CG...dangerous
124
-    //auto EM3D = EMSchur3D< Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > >::NewSP();
125
-    //auto EM3D = EMSchur3D< Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower, Eigen::IncompleteCholesky<Complex> > >::NewSP();
124
+    //auto EM3D = EMSchur3D< Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > >::NewSP();
125
+    //auto EM3D = EMSchur3D< Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower, Eigen::IncompleteCholesky<Complex> > >::NewSP();
126 126
 
127 127
     // LU direct
128
-    auto EM3D = EMSchur3D< Eigen::SparseLU<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::COLAMDOrdering<int> > >::NewSP();
128
+    //auto EM3D = EMSchur3D< Eigen::SparseLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::COLAMDOrdering<int> > >::NewSP();
129 129
 
130 130
     EM3D->SetRectilinearGrid( gimp->GetGrid() );
131 131
 

+ 1
- 1
examples/EMSchur3D.cpp View File

@@ -29,7 +29,7 @@ using namespace Lemma;
29 29
 int main( int argc, char** argv ) {
30 30
 
31 31
     // BiCGSTAB Diagonal preconditioner
32
-    auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::IncompleteLUT<Complex> > >::NewSP();
32
+    auto EM3D = EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::IncompleteLUT<Complex> > >::NewSP();
33 33
 
34 34
     if (argc < 3) {
35 35
         std::cout << "EMSchur3D  <rgrid>  <1dmod> <3dmod>  <aemsurvey> " << std::endl;

+ 49
- 39
include/EMSchur3D.h View File

@@ -54,7 +54,7 @@ namespace Lemma {
54 54
          */
55 55
         static std::shared_ptr< EMSchur3D > NewSP() {
56 56
             return std::make_shared< EMSchur3D<Solver> >( ctor_key() );
57
-            //return std::make_shared< EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::RowMajor> > > >( ctor_key() ) ;
57
+            //return std::make_shared< EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::ColMajor> > > >( ctor_key() ) ;
58 58
         }
59 59
 
60 60
         /** Default protected constructor, use New */
@@ -234,13 +234,11 @@ namespace Lemma {
234 234
         VectorXcr ADiv = D*A;  // ADiv == RHS == D C^I Se
235 235
         VectorXcr Error = ((Cc.selfadjointView<Eigen::Lower>()*A).array() - Se.array());
236 236
         logio << "|| Div(A) || = " << ADiv.norm()
237
-                // << " in " << iter_done << " iterations"
238
-              //<<  " with error " << errorn << "\t"
239 237
               << "\tInital solution error="<<   Error.norm()  // Iteritive info
240
-//              << "\tSolver reported error="<<   CSolver[iw].error()  // Iteritive info
238
+              << "\tSolver reported error="<<   CSolver[iw].error()  // Iteritive info
241 239
               << "\ttime " << timer.end() / 60. << " [m]   "
242
-//             <<  CSolver[iw].iterations() << "  iterations"
243
-            << std::endl;
240
+              <<  CSolver[iw].iterations() << "  iterations"
241
+              << std::endl;
244 242
 
245 243
         //VectorXcr ADivMAC = ADiv.array() * MAC.array().cast<Complex>();
246 244
         //logio << "|| Div(A) || on MAC grid " << ADivMAC.norm() << std::endl;
@@ -288,14 +286,26 @@ namespace Lemma {
288 286
         A = CSolver[iw].solve( (Se-E).eval() ); // UmfPack requires eval?
289 287
 
290 288
         VectorXcr ADiv2 = D*A;
291
-        logio << "|| Div(A) || = " << ADiv2.norm() ;
289
+
290
+        //logio << "|| Div(A) || = " << ADiv2.norm() ;
292 291
               //" in " << iter_done << " iterations"
293 292
               //<<  " with error " << errorn << "\t";
294 293
 
295 294
         // Report error of solutions
296 295
         Error = ((Cc.selfadjointView<Eigen::Lower>()*A).array() + E.array() - Se.array());
297
-        logio << "\tsolution error " << Error.norm()
298
-              << std::fixed << std::setprecision(2) << "\ttime " << timer.end()/60. << "\ttotal time " << timer2.end()/60. << std::endl;
296
+        //logio << "\tsolution error " << Error.norm()
297
+        //      << std::fixed << std::setprecision(2) << "\ttime " << timer.end()/60. << "\ttotal time " << timer2.end()/60. << std::endl;
298
+        //      << "\tSolver reported error="<<   CSolver[iw].error()  // Iteritive info
299
+        //      << "\ttime " << timer.end() / 60. << " [m]   "
300
+        //      <<  CSolver[iw].iterations() << "  iterations"
301
+
302
+
303
+        logio << "|| Div(A) || = " << ADiv2.norm()
304
+              << "\tInital solution error="<<   Error.norm()  // Iteritive info
305
+              << "\tSolver reported error="<<   CSolver[iw].error()  // Iteritive info
306
+              << "\ttime " << timer.end() / 60. << " [m]   "
307
+              <<  CSolver[iw].iterations() << "  iterations"
308
+              << std::endl;
299 309
         logio.close();
300 310
 
301 311
         //////////////////////////////////////
@@ -348,9 +358,9 @@ namespace Lemma {
348 358
 
349 359
     #ifdef HAVE_SUPERLUMT
350 360
     template<>
351
-    void EMSchur3D< Eigen::SuperLU<Eigen::SparseMatrix<Complex, Eigen::RowMajor> > >::BuildCDirectSolver() {
361
+    void EMSchur3D< Eigen::SuperLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor> > >::BuildCDirectSolver() {
352 362
 
353
-        CSolver = new Eigen::SuperLU<Eigen::SparseMatrix<Complex, Eigen::RowMajor> > [Omegas.size()];
363
+        CSolver = new Eigen::SuperLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor> > [Omegas.size()];
354 364
 
355 365
         for (int iw=0; iw<Omegas.size(); ++iw) {
356 366
             jsw_timer timer;
@@ -388,8 +398,8 @@ namespace Lemma {
388 398
     #endif
389 399
 
390 400
     template<>
391
-    void EMSchur3D< Eigen::SparseLU<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::COLAMDOrdering<int> > >::BuildCDirectSolver() {
392
-        CSolver = new Eigen::SparseLU<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::COLAMDOrdering<int> > [Omegas.size()];
401
+    void EMSchur3D< Eigen::SparseLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::COLAMDOrdering<int> > >::BuildCDirectSolver() {
402
+        CSolver = new Eigen::SparseLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::COLAMDOrdering<int> > [Omegas.size()];
393 403
         for (int iw=0; iw<Omegas.size(); ++iw) {
394 404
             jsw_timer timer;
395 405
             timer.begin();
@@ -415,8 +425,8 @@ namespace Lemma {
415 425
     }
416 426
 
417 427
 //     template<>
418
-//     void EMSchur3D< Eigen::CholmodSupernodalLLT< Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > > ::BuildCDirectSolver() {
419
-//         CSolver = new Eigen::CholmodSupernodalLLT< Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > [Omegas.size()];
428
+//     void EMSchur3D< Eigen::CholmodSupernodalLLT< Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > > ::BuildCDirectSolver() {
429
+//         CSolver = new Eigen::CholmodSupernodalLLT< Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > [Omegas.size()];
420 430
 //         for (int iw=0; iw<Omegas.size(); ++iw) {
421 431
 //             Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
422 432
 //             jsw_timer timer;
@@ -436,8 +446,8 @@ namespace Lemma {
436 446
 //     }
437 447
 
438 448
 //     template<>
439
-//     void EMSchur3D< Eigen::CSymSimplicialLLT< Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower, Eigen::NaturalOrdering<int> > > ::BuildCDirectSolver() {
440
-//         CSolver = new Eigen::CSymSimplicialLLT< Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower, Eigen::NaturalOrdering<int> > [Omegas.size()];
449
+//     void EMSchur3D< Eigen::CSymSimplicialLLT< Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower, Eigen::NaturalOrdering<int> > > ::BuildCDirectSolver() {
450
+//         CSolver = new Eigen::CSymSimplicialLLT< Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower, Eigen::NaturalOrdering<int> > [Omegas.size()];
441 451
 //         for (int iw=0; iw<Omegas.size(); ++iw) {
442 452
 //             Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
443 453
 //             jsw_timer timer;
@@ -457,8 +467,8 @@ namespace Lemma {
457 467
 //     }
458 468
 //
459 469
 //     template<>
460
-//     void EMSchur3D< Eigen::CSymSimplicialLLT< Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower, Eigen::AMDOrdering<int> > > ::BuildCDirectSolver() {
461
-//         CSolver = new Eigen::CSymSimplicialLLT< Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower, Eigen::AMDOrdering<int> > [Omegas.size()];
470
+//     void EMSchur3D< Eigen::CSymSimplicialLLT< Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower, Eigen::AMDOrdering<int> > > ::BuildCDirectSolver() {
471
+//         CSolver = new Eigen::CSymSimplicialLLT< Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower, Eigen::AMDOrdering<int> > [Omegas.size()];
462 472
 //         for (int iw=0; iw<Omegas.size(); ++iw) {
463 473
 //             //Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
464 474
 //             jsw_timer timer;
@@ -478,8 +488,8 @@ namespace Lemma {
478 488
 //     }
479 489
 //
480 490
 //     template<>
481
-//     void EMSchur3D< Eigen::CSymSimplicialLDLT< Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower, Eigen::AMDOrdering<int> > > ::BuildCDirectSolver() {
482
-//         CSolver = new Eigen::CSymSimplicialLDLT< Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower, Eigen::AMDOrdering<int> > [Omegas.size()];
491
+//     void EMSchur3D< Eigen::CSymSimplicialLDLT< Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower, Eigen::AMDOrdering<int> > > ::BuildCDirectSolver() {
492
+//         CSolver = new Eigen::CSymSimplicialLDLT< Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower, Eigen::AMDOrdering<int> > [Omegas.size()];
483 493
 //         for (int iw=0; iw<Omegas.size(); ++iw) {
484 494
 //             Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
485 495
 //             jsw_timer timer;
@@ -500,12 +510,12 @@ namespace Lemma {
500 510
 
501 511
 
502 512
     template<>
503
-    void EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::IncompleteLUT<Complex> > > ::BuildCDirectSolver() {
504
-        CSolver = new Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::IncompleteLUT<Complex> > [Omegas.size()];
513
+    void EMSchur3D< Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::IncompleteLUT<Complex> > > ::BuildCDirectSolver() {
514
+        CSolver = new Eigen::BiCGSTAB<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::IncompleteLUT<Complex> > [Omegas.size()];
505 515
         for (int iw=0; iw<Omegas.size(); ++iw) {
506 516
             Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
507
-            CSolver[iw].preconditioner().setDroptol(1e-12);      // 1e-12
508
-            CSolver[iw].preconditioner().setFillfactor(1e1);     // 1e2
517
+            CSolver[iw].preconditioner().setDroptol(1e-5);      // 1e-12
518
+            //CSolver[iw].preconditioner().setFillfactor(5e1);     // 1e2
509 519
             jsw_timer timer;
510 520
             timer.begin();
511 521
             /*  Complex system */
@@ -523,8 +533,8 @@ namespace Lemma {
523 533
     }
524 534
 
525 535
     template<>
526
-    void EMSchur3D< Eigen::BiCGSTAB< Eigen::SparseMatrix<Complex, Eigen::RowMajor> > > ::BuildCDirectSolver() {
527
-        CSolver = new Eigen::BiCGSTAB< Eigen::SparseMatrix<Complex, Eigen::RowMajor> > [Omegas.size()];
536
+    void EMSchur3D< Eigen::BiCGSTAB< Eigen::SparseMatrix<Complex, Eigen::ColMajor> > > ::BuildCDirectSolver() {
537
+        CSolver = new Eigen::BiCGSTAB< Eigen::SparseMatrix<Complex, Eigen::ColMajor> > [Omegas.size()];
528 538
         for (int iw=0; iw<Omegas.size(); ++iw) {
529 539
             Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
530 540
             jsw_timer timer;
@@ -544,8 +554,8 @@ namespace Lemma {
544 554
     }
545 555
 
546 556
     template<>
547
-    void EMSchur3D< Eigen::LeastSquaresConjugateGradient< Eigen::SparseMatrix<Complex, Eigen::RowMajor> > > ::BuildCDirectSolver() {
548
-        CSolver = new Eigen::LeastSquaresConjugateGradient< Eigen::SparseMatrix<Complex, Eigen::RowMajor> > [Omegas.size()];
557
+    void EMSchur3D< Eigen::LeastSquaresConjugateGradient< Eigen::SparseMatrix<Complex, Eigen::ColMajor> > > ::BuildCDirectSolver() {
558
+        CSolver = new Eigen::LeastSquaresConjugateGradient< Eigen::SparseMatrix<Complex, Eigen::ColMajor> > [Omegas.size()];
549 559
         for (int iw=0; iw<Omegas.size(); ++iw) {
550 560
             Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
551 561
             jsw_timer timer;
@@ -565,8 +575,8 @@ namespace Lemma {
565 575
     }
566 576
 
567 577
     template<>
568
-    void EMSchur3D<   Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > > ::BuildCDirectSolver() {
569
-        CSolver = new Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > [Omegas.size()];
578
+    void EMSchur3D<   Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > > ::BuildCDirectSolver() {
579
+        CSolver = new Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > [Omegas.size()];
570 580
         for (int iw=0; iw<Omegas.size(); ++iw) {
571 581
             //Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
572 582
             jsw_timer timer;
@@ -586,8 +596,8 @@ namespace Lemma {
586 596
     }
587 597
 
588 598
     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()];
599
+    void EMSchur3D<   Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower, Eigen::IncompleteCholesky<Complex> > > ::BuildCDirectSolver() {
600
+        CSolver = new Eigen::ConjugateGradient<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower, Eigen::IncompleteCholesky<Complex> > [Omegas.size()];
591 601
         for (int iw=0; iw<Omegas.size(); ++iw) {
592 602
             //Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
593 603
             jsw_timer timer;
@@ -607,8 +617,8 @@ namespace Lemma {
607 617
     }
608 618
 
609 619
 //     template<>
610
-//     void EMSchur3D<   Eigen::PastixLLT<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > > ::BuildCDirectSolver() {
611
-//         CSolver = new Eigen::PastixLLT<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > [Omegas.size()];
620
+//     void EMSchur3D<   Eigen::PastixLLT<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > > ::BuildCDirectSolver() {
621
+//         CSolver = new Eigen::PastixLLT<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > [Omegas.size()];
612 622
 //         //MPI_Init(NULL, NULL);
613 623
 //         for (int iw=0; iw<Omegas.size(); ++iw) {
614 624
 //             //Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
@@ -629,8 +639,8 @@ namespace Lemma {
629 639
 //     }
630 640
 //
631 641
 //     template<>
632
-//     void EMSchur3D<   Eigen::PastixLDLT<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > > ::BuildCDirectSolver() {
633
-//         CSolver = new Eigen::PastixLDLT<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, Eigen::Lower > [Omegas.size()];
642
+//     void EMSchur3D<   Eigen::PastixLDLT<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > > ::BuildCDirectSolver() {
643
+//         CSolver = new Eigen::PastixLDLT<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, Eigen::Lower > [Omegas.size()];
634 644
 //         //MPI_Init(NULL, NULL);
635 645
 //         for (int iw=0; iw<Omegas.size(); ++iw) {
636 646
 //             //Csym = Cvec[iw].selfadjointView<Eigen::Lower>();
@@ -652,8 +662,8 @@ namespace Lemma {
652 662
 //     }
653 663
 //
654 664
 //     template<>
655
-//     void EMSchur3D<   Eigen::PastixLU<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, true > > ::BuildCDirectSolver() {
656
-//         CSolver = new Eigen::PastixLU<Eigen::SparseMatrix<Complex, Eigen::RowMajor>, true > [Omegas.size()];
665
+//     void EMSchur3D<   Eigen::PastixLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, true > > ::BuildCDirectSolver() {
666
+//         CSolver = new Eigen::PastixLU<Eigen::SparseMatrix<Complex, Eigen::ColMajor>, true > [Omegas.size()];
657 667
 //         //MPI_Init(NULL, NULL);
658 668
 //         for (int iw=0; iw<Omegas.size(); ++iw) {
659 669
 //             Csym = Cvec[iw].selfadjointView<Eigen::Lower>();

+ 4
- 4
include/EMSchur3DBase.h View File

@@ -355,13 +355,13 @@ class EMSchur3DBase : public LemmaObject {
355 355
 
356 356
     /** Matrix objects representing discrete operators
357 357
      */
358
-    Eigen::SparseMatrix<Complex, Eigen::RowMajor>*                  Cvec;
359
-    Eigen::SparseMatrix<Complex, Eigen::RowMajor>                   D;
358
+    Eigen::SparseMatrix<Complex, Eigen::ColMajor>*                  Cvec;
359
+    Eigen::SparseMatrix<Complex, Eigen::ColMajor>                   D;
360 360
 
361 361
     /** Squeezed matrices for reduced phi grid
362 362
      */
363
-    Eigen::SparseMatrix<Complex, Eigen::RowMajor>*                  Cvec_s;
364
-    Eigen::SparseMatrix<Complex, Eigen::RowMajor>                   D_s;
363
+    Eigen::SparseMatrix<Complex, Eigen::ColMajor>*                  Cvec_s;
364
+    Eigen::SparseMatrix<Complex, Eigen::ColMajor>                   D_s;
365 365
 
366 366
     /** number of cells in x, set when RectilinearGrid is attached */
367 367
     int nx;

+ 4
- 4
include/bicgstab.h View File

@@ -326,7 +326,7 @@ bool preconditionedSCBiCG(const SparseMat &A, const Preconditioner &M,
326 326
 
327 327
 /** \internal Low-level conjugate gradient algorithm
328 328
   * \param mat The matrix A
329
-  * \param rhs The right hand side vector b
329
+  * \param rhs The right hand side vector b5
330 330
   * \param x On input and initial solution, on output the computed solution.
331 331
   * \param precond A preconditioner being able to efficiently solve for an
332 332
   *                approximation of Ax=b (regardless of b)
@@ -474,7 +474,7 @@ inline VectorXcr implicitDCInvBPhi3 (const SparseMat& D, const Solver& solver,
474 474
     VectorXcr b = (ioms).asDiagonal() * (D.transpose()*Phi);
475 475
     VectorXcr y = solver.solve(b);
476 476
     //max_it = 0;
477
-    //max_it = solver.iterations();
477
+    max_it = solver.iterations();
478 478
     //errorn = solver.error();
479 479
     return  D*y;
480 480
 }
@@ -746,7 +746,7 @@ int implicitbicgstab_ei(const SparseMat&  D,
746 746
         tol2 = tol;
747 747
         max_it2 = 500000;
748 748
         v = implicitDCInvBPhi3(D, solver, ioms, p, tol2, max_it2);
749
-        max_it2 = 0; // solver.iterations();
749
+        max_it2 = solver.iterations();
750 750
 
751 751
         alpha = rho / r_tld.dot(v);
752 752
         s = r.array() - alpha*v.array();
@@ -760,7 +760,7 @@ int implicitbicgstab_ei(const SparseMat&  D,
760 760
         tol2 = tol;
761 761
         max_it1 = 500000;
762 762
         t = implicitDCInvBPhi3(D, solver, ioms, s, tol2, max_it1);
763
-        max_it1 = 0; //solver.iterations();
763
+        max_it1 = solver.iterations();
764 764
         omega = t.dot(s)  / t.dot(t);
765 765
 
766 766
         r = s.array() - omega*t.array();

+ 1
- 1
src/EMSchur3DBase.cpp View File

@@ -877,7 +877,7 @@ namespace Lemma {
877 877
         // First set up grid stuff
878 878
         if (Cvec) delete [] Cvec;
879 879
         //if (CSolver) delete [] CSolver;
880
-        Cvec    = new Eigen::SparseMatrix<Complex, Eigen::RowMajor> [Omegas.size()];
880
+        Cvec    = new Eigen::SparseMatrix<Complex, Eigen::ColMajor> [Omegas.size()];
881 881
 
882 882
         //#ifdef LEMMAUSEOMP
883 883
         //#pragma omp parallel for schedule(static, 1)

Loading…
Cancel
Save