File: areig.h

package info (click to toggle)
arpack%2B%2B 2.1-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 4,216 kB
  • ctags: 2,349
  • sloc: cpp: 19,093; ansic: 2,201; makefile: 508
file content (1108 lines) | stat: -rw-r--r-- 38,714 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
/*
   ARPACK++ v1.0 8/1/1997
   c++ interface to ARPACK code.

   MODULE AREig.h.
   Example functions AREig. This function returns eigenvalues, EigVal, and
   eigenvectors, EigVec, of real symmetric, real nonsymmetric and complex
   problems in various modes using ARluSymStdEig, ARluNonSymStdEig and
   ARluNonSymGenEig classes.
   The SuperLU package is employed to solve the linear systems that appear
   when the shift-and-invert spectral transformation is being used.

   There are eighteen different versions of AREig, as shown below. The type
   and the meaning of each AREig parameter is briefly described in section
   II. For a complete description of all parameters, see the Appendix of
   "ARPACK++: a c++ implementation of ARPACK eigenvalue package."

   I) How to call AREig:

      AREig is a c++ overloaded function, which means that there are
      several definitions for this single function. Each definition is
      related to a different problem and a different kind of data. All
      twenty six available AREig functions are listed below. They are
      divided according to the problem type (standard or generalized),
      the type of the involved matrices (real or complex), the
      computational mode being used (regular or shift-and-invert) and
      the desired output data (only eigenvalues or eigenvalues and
      eigenvectors).

      1) Real symmetric standard problems:

         a) Regular mode:

            i)  To obtain only eigenvalues:

                int AREig(EigVal, n, nnz, A, irow, pcol, uplo, nev,
                          which, ncv, tol, maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigVal, EigVec, n, nnz, A, irow, pcol, uplo,
                          nev, which, ncv, tol, maxit, resid, AutoShift)

         b) Real shift-and-invert mode:

            i)  To obtain only eigenvalues:

                int AREig(EigVal, n, nnz, A, irow, pcol, uplo, sigma,
                          nev, which, ncv, tol, maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigVal, EigVec, n, nnz, A, irow, pcol, uplo, sigma,
                          nev, which, ncv, tol, maxit, resid, AutoShift)

      2) Real symmetric generalized problems:

         a) Regular mode:

            i)  To obtain only eigenvalues:

                int AREig(EigVal, n, nnzA, A, irowA, pcolA, nnzB, B,
                          irowB, pcolB, uplo, nev, which, ncv, tol,
                          maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigVal, EigVec, n, nnzA, A, irowA, pcolA,
                          nnzB, B, irowB, pcolB, uplo, nev, which,
                          ncv, tol, maxit, resid, AutoShift)

         b) Shift-and-invert, buckling and Cayley modes:

            i)  To obtain only eigenvalues:

                int AREig(EigVal, n, nnzA, A, irowA, pcolA, nnzB, B,
                          irowB, pcolB, uplo, InvertMode, sigma, nev,
                          which, ncv, tol, maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigVal, EigVec, n, nnzA, A, irowA, pcolA, nnzB,
                          B, irowB, pcolB, uplo, InvertMode, sigma, nev,
                          which, ncv, tol, maxit, resid, AutoShift)

      3) Real nonsymmetric standard problems:

         a) Regular mode:

            i)  To obtain only eigenvalues:

                int AREig(EigValR, EigValI, n, nnz, A, irow, pcol, nev,
                          which, ncv, tol, maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigValR, EigValI, EigVec, n, nnz, A, irow, pcol,
                          nev, which, ncv, tol, maxit, resid, AutoShift)

         b) Real shift-and-invert mode:

            i)  To obtain only eigenvalues:

                int AREig(EigValR, EigValI, n, nnz, A, irow, pcol, sigma,
                          nev, which, ncv, tol, maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigValR, EigValI, EigVec, n, nnz, A, irow, pcol,
                          sigma, nev, which, ncv, tol, maxit, resid, AutoShift)

      4) Real nonsymmetric generalized problems:

         a) Regular mode:

            i)  To obtain only eigenvalues:

                int AREig(EigValR, EigValI, n, nnzA, A, irowA, pcolA,
                          nnzB, B, irowB, pcolB, nev, which, ncv, tol,
                          maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigValR, EigValI, EigVec, n, nnzA, A, irowA,
                          pcolA, nnzB, B, irowB, pcolB, nev, which, ncv,
                          tol, maxit, resid, AutoShift)

         b) Real shift-and-invert mode:

            i)  To obtain only eigenvalues:

                int AREig(EigValR, EigValI, n, nnzA, A, irowA, pcolA,
                          nnzB, B, irowB, pcolB, sigma, nev, which, ncv,
                          tol, maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigValR, EigValI, EigVec, n, nnzA, A, irowA,
                          pcolA, nnzB, B, irowB, pcolB, sigma, nev, which,
                          ncv, tol, maxit, resid, AutoShift)

         c) Complex shift-and-invert mode:

            i)  To obtain only eigenvalues:

                int AREig(EigValR, EigValI, n, nnzA, A, irowA, pcolA,
                          nnzB, B, irowB, pcolB, part, sigmaR, SigmaI,
                          nev, which, ncv, tol, maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigValR, EigValI, EigVec, n, nnzA, A, irowA, pcolA,
                          nnzB, B, irowB, pcolB, part, sigmaR, SigmaI,
                          nev, which, ncv, tol, maxit, resid, AutoShift)

      5) Complex standard problems:

         a) Regular mode:

            i)  To obtain only eigenvalues:

                int AREig(EigVal, n, nnz, A, irow, pcol, nev,
                          which, ncv, tol, maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigVal, EigVec, n, nnz, A, irow, pcol, nev,
                          which, ncv, tol, maxit, resid, AutoShift)

         b) Shift-and-invert mode:

            i)  To obtain only eigenvalues:

                int AREig(EigVal, n, nnz, A, irow, pcol, sigma,
                          nev, which, ncv, tol, maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigVal, EigVec, n, nnz, A, irow, pcol, sigma,
                          nev, which, ncv, tol, maxit, resid, AutoShift)

      6) Complex generalized problems:

         a) Regular mode:

            i)  To obtain only eigenvalues:

                int AREig(EigVal, n, nnzA, A, irowA, pcolA, nnzB, B,
                          irowB, pcolB, nev, which, ncv, tol, maxit,
                          resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigVal, EigVec, n, nnzA, A, irowA, pcolA,
                          nnzB, B, irowB, pcolB, nev, which, ncv, tol,
                          maxit, resid, AutoShift)

         b) Shift-and-invert mode:

            i)  To obtain only eigenvalues:

                int AREig(EigVal, n, nnzA, A, irowA, pcolA, nnzB, B,
                          irowB, pcolB, sigma, nev, which, ncv, tol,
                          maxit, resid, AutoShift)

            ii) To obtain eigenvalues and eigenvectors:

                int AREig(EigVal, EigVec, n, nnzA, A, irowA, pcolA,
                          nnzB, B, irowB, pcolB, sigma, nev, which,
                          ncv, tol, maxit, resid, AutoShift)


   II) AREig parameters:

   Each AREig function contains a variable number of parameters, because
   some parameters are not mandatory. Optional parameters should only be
   defined by the used if the default values supplied by the function are
   not suitable.
   In the description of AREig parameters, the following notation is used
   to describe eigenvalue problems:
   a) standard problems:    A*EigVec = Eigvec*EigVal,
   b) generalized problems: A*EigVec = B*EigVec*EigVal.

      1) Compulsory input parameters:

      int n            Dimension of the problem.

      int nnz          Number of nonzero elements in matrix A.

      int nnzA         Same as nnz.

      int nnzB         Number of nonzero elements in matrix B.

      TYPE A[]         Array of nonzero elements in matrix A.
                       TYPE must be one of "float", "double",
                       "arcomplex<float>" or "arcomplex<double>".

      TYPE B[]         Array of nonzero elements in matrix B.
                       TYPE must be one of "float", "double",
                       "arcomplex<float>" or "arcomplex<double>".

      int irow[]       Array of row indices of the nonzero elements in A.

      int irowA[]      Same as irow.

      int irowB[]      Array of row indices of the nonzero elements in B.

      int pcol[]       Array of pointers to the beginning of columns in
                       A and irow. pcol must have n+1 elements and the
                       last element must be nnz.

      int pcolA[]      Same as pcol.

      int pcolB[]      Array of pointers to the beginning of columns in
                       B and irowB. pcol must have n+1 elements and the
                       last element must be nnzB.

      char uplo        A parameter used only if the problem is symmetric.
                       uplo indicates whether the lower uplo = L) or the
                       upper triangular (uplo = U) part of A (and also
                       B, if the problem is a generalized one) is being
                       supplied by the user.

      char InvertMode  Spectral transformation used when solving symmetric
                       generalized problems. To use the shift and invert
                       mode, the user must set InvertMode to 'S'.  Buckling
                       and Cayley modes are represented by 'B' and 'C',
                       respectively.

      TYPE sigma       The shift (when shift-and invert mode is being used).
                       TYPE must be one of "float" or "double" if the
                       problem is nonsymmetric and sigma is real, or one of
                       "arcomplex<float>" or "arcomplex<double>" if the
                       problem is complex.

      FLOAT sigmaR     Real part of the shift if the problem is real but
                       the shift is complex. FLOAT must be one of "float"
                       or "double".

      FLOAT sigmaI     Imaginary part of the shift if the problem is real
                       but the shift is complex. FLOAT must be one of
                       "float" or "double".

      char part        A parameter that characterizes which part (real or
                       imaginary) of the vector y = OP*x will be used by
                       ARPACK++ when the problem is real but the shift is
                       complex. "part" must be set to one of 'R' (real
                       part) or 'I' (imaginary part).

      int  nev         Number of eigenvalues to be computed.


      2) Optional input parameters:

      char* which      A parameter thar specifies which of the Ritz values
                       are to be computed. "which" must be set to one of:
                       LM: to find eigenvalues with largest magnitude;
                       SM: to find eigenvalues with smallest magnitude;
                       LR: to find eigenvalues with largest real part;
                       SR: to find eigenvalues with smallest real part;
                       LI: to find eigenvalues with largest imaginary part;
                       SI: to find eigenvalues with smallest imaginary part.
                       Default: LM.

      int  ncv         Number of Arnoldi vectors generated at each
                       iteration of ARPACK. Default: 2*nev+1.

      FLOAT tol        Stopping criterion (relative accuracy of Ritz
                       values). FLOAT must be one of "float" or "double".
                       Default: machine precision.

      int  maxit       Maximum number of Arnoldi update iterations allowed.
                       Default: 100*nev.

      TYPE* resid      A pointer to an array that contains the initail
                       vector. Default: a random vector.
                       TYPE must be one of "float", "double",
                       "arcomplex<float>" or "arcomplex<double>".

      bool AutoShift   A parameter that indicates if exact shifts for
                       implicit restarting of the Arnoldi method are to
                       be generated internally by ARPACK++ or shifts are
                       being supplied by the user. Default: true (exact
                       shifts are being used).

      3) Output parameters:

      TYPE  EigVal[]   A vector that contains the "converged" eigenvalues
                       when the problem is symmetric or complex. TYPE
                       must be one float, double, "arcomplex<float>" or
                       "arcomplex<double>".

      FLOAT EigValR[]  A vector that contains the real part of the
                       "converged" eigenvalues (when the problem is real).
                       FLOAT must be one of "float" or "double".

      FLOAT EigValI[]  A vector that contains the imaginary part of the
                       "converged" eigenvalues (when the problem is real).
                       FLOAT must be one of "float" or "double".

      TYPE  EigVec[]   A vector that stores all "converged" eigenvectors
                       consecutively. For real problems, complex eigenvectors
                       are given as two consecutive vectors. The first
                       contains the real part of the eigenvector, while
                       the imaginary part is stored in the second vector.
                       TYPE must be one of "float", "double",
                       "arcomplex<float>" or "arcomplex<double>".


   ARPACK Authors
      Richard Lehoucq
      Danny Sorensen
      Chao Yang
      Dept. of Computational & Applied Mathematics
      Rice University
      Houston, Texas
*/

#ifndef AREIG_H
#define AREIG_H


#include "arcomp.h"
#include "arlsmat.h"
#include "arlnsmat.h"
#include "arlssym.h"
#include "arlgsym.h"
#include "arlsnsym.h"
#include "arlgnsym.h"
#include "arlscomp.h"
#include "arlgcomp.h"


template <class FLOAT>
int AREig(arcomplex<FLOAT> EigVal[], int n, int nnz, arcomplex<FLOAT> A[],
          int irow[], int pcol[], int nev, char* which = "LM", int ncv = 0,
          FLOAT tol = 0.0, int maxit = 0, arcomplex<FLOAT>* resid = 0,
          bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluNonSymMatrix<arcomplex<FLOAT> > matrix(n, nnz, A, irow, pcol);

  // Defining the eigenvalue problem.

  ARluCompStdEig<FLOAT> prob(nev, matrix, which, ncv, tol,
                             maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigVal);

} // complex standard problem, only eigenvalues, regular mode.


template <class FLOAT>
int AREig(arcomplex<FLOAT> EigVal[], arcomplex<FLOAT> EigVec[], int n,
          int nnz, arcomplex<FLOAT> A[], int irow[], int pcol[],
          int nev, char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, arcomplex<FLOAT>* resid = 0, bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluNonSymMatrix<arcomplex<FLOAT> > matrix(n, nnz, A, irow, pcol);

  // Defining the eigenvalue problem.

  ARluCompStdEig<FLOAT> prob(nev, matrix, which, ncv, tol,
                             maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigVal);

} // complex standard problem, values and vectors, regular mode.


template <class FLOAT>
int AREig(arcomplex<FLOAT> EigVal[], int n, int nnz, arcomplex<FLOAT> A[],
          int irow[], int pcol[], arcomplex<FLOAT> sigma, int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0, int maxit = 0,
          arcomplex<FLOAT>* resid = 0, bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluNonSymMatrix<arcomplex<FLOAT> > matrix(n, nnz, A, irow, pcol);

  // Defining the eigenvalue problem.

  ARluCompStdEig<FLOAT> prob(nev, matrix, sigma, which, ncv,
                             tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigVal);

} // complex standard problem, only eigenvalues, shift-and-invert.


template <class FLOAT>
int AREig(arcomplex<FLOAT> EigVal[], arcomplex<FLOAT> EigVec[], int n,
          int nnz, arcomplex<FLOAT> A[], int irow[], int pcol[],
          arcomplex<FLOAT> sigma, int nev, char* which = "LM",
          int ncv = 0, FLOAT tol = 0.0, int maxit = 0,
          arcomplex<FLOAT>* resid = 0, bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluNonSymMatrix<arcomplex<FLOAT> > matrix(n, nnz, A, irow, pcol);

  // Defining the eigenvalue problem.

  ARluCompStdEig<FLOAT> prob(nev, matrix, sigma, which, ncv,
                             tol, maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigVal);

} // complex standard problem, values and vectors, shift-and-invert.


template <class FLOAT>
int AREig(arcomplex<FLOAT> EigVal[], int n, int nnzA,
          arcomplex<FLOAT> A[], int irowA[], int pcolA[], int nnzB,
          arcomplex<FLOAT> B[], int irowB[], int pcolB[], int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0, int maxit = 0,
          arcomplex<FLOAT>* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<arcomplex<FLOAT> > matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<arcomplex<FLOAT> > matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluCompGenEig<FLOAT> prob(nev, matrixA, matrixB, which,
                             ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigVal);

} // complex generalized problem, only eigenvalues, regular mode.


template <class FLOAT>
int AREig(arcomplex<FLOAT> EigVal[], arcomplex<FLOAT> EigVec[], int n,
          int nnzA, arcomplex<FLOAT> A[], int irowA[], int pcolA[],
          int nnzB, arcomplex<FLOAT> B[], int irowB[], int pcolB[],
          int nev, char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, arcomplex<FLOAT>* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<arcomplex<FLOAT> > matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<arcomplex<FLOAT> > matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluCompGenEig<FLOAT> prob(nev, matrixA, matrixB, which,
                             ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigVal);

} // complex generalized problem, values and vectors, regular mode.


template <class FLOAT>
int AREig(arcomplex<FLOAT> EigVal[], int n, int nnzA, arcomplex<FLOAT> A[],
          int irowA[], int pcolA[], int nnzB, arcomplex<FLOAT> B[],
          int irowB[], int pcolB[], arcomplex<FLOAT> sigma, int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0, int maxit = 0,
          arcomplex<FLOAT>* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<arcomplex<FLOAT> > matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<arcomplex<FLOAT> > matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluCompGenEig<FLOAT> prob(nev, matrixA, matrixB, sigma, which,
                             ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigVal);

} // complex generalized problem, only eigenvalues, shift-and-invert mode.


template <class FLOAT>
int AREig(arcomplex<FLOAT> EigVal[], arcomplex<FLOAT> EigVec[], int n,
          int nnzA, arcomplex<FLOAT> A[], int irowA[], int pcolA[],
          int nnzB, arcomplex<FLOAT> B[], int irowB[], int pcolB[],
          arcomplex<FLOAT> sigma, int nev, char* which = "LM",
          int ncv = 0, FLOAT tol = 0.0, int maxit = 0,
          arcomplex<FLOAT>* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<arcomplex<FLOAT> > matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<arcomplex<FLOAT> > matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluCompGenEig<FLOAT> prob(nev, matrixA, matrixB, sigma, which,
                             ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigVal);

} // complex generalized problem, values and vectors, shift-and-invert mode.


template <class FLOAT>
int AREig(double EigValR[], FLOAT EigValI[], int n, int nnz,
          FLOAT A[], int irow[], int pcol[], int nev, char* which = "LM",
          int ncv = 0, FLOAT tol = 0.0, int maxit = 0, FLOAT* resid = 0,
          bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrix(n, nnz, A, irow, pcol);

  // Defining the eigenvalue problem.

  ARluNonSymStdEig<FLOAT> prob(nev, matrix, which, ncv, tol,
                               maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigValR, EigValI);

} // real nonsymmetric standard problem, only eigenvalues, regular mode.


template <class FLOAT>
int AREig(float EigValR[], FLOAT EigValI[], int n, int nnz,
          FLOAT A[], int irow[], int pcol[], int nev, char* which = "LM",
          int ncv = 0, FLOAT tol = 0.0, int maxit = 0, FLOAT* resid = 0,
          bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrix(n, nnz, A, irow, pcol);

  // Defining the eigenvalue problem.

  ARluNonSymStdEig<FLOAT> prob(nev, matrix, which, ncv, tol,
                               maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigValR, EigValI);

} // real nonsymmetric standard problem, only eigenvalues, regular mode.


template <class FLOAT>
int AREig(FLOAT EigValR[], FLOAT EigValI[], FLOAT EigVec[], int n, int nnz,
          FLOAT A[], int irow[], int pcol[], int nev, char* which = "LM",
          int ncv = 0, FLOAT tol = 0.0, int maxit = 0, FLOAT* resid = 0,
          bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrix(n, nnz, A, irow, pcol);

  // Defining the eigenvalue problem.

  ARluNonSymStdEig<FLOAT> prob(nev, matrix, which, ncv, tol,
                               maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigValR, EigValI);

} // real nonsymmetric standard problem, values and vectors, regular mode.


template <class FLOAT>
int AREig(double EigValR[], FLOAT EigValI[], int n, int nnz,
          FLOAT A[], int irow[], int pcol[], FLOAT sigma, int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrix(n, nnz, A, irow, pcol);

  // Defining the eigenvalue problem.

  ARluNonSymStdEig<FLOAT> prob(nev, matrix, sigma, which, ncv,
                               tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigValR, EigValI);

} // real nonsymmetric standard problem, only eigenvalues, shift-and-invert.


template <class FLOAT>
int AREig(float EigValR[], FLOAT EigValI[], int n, int nnz,
          FLOAT A[], int irow[], int pcol[], FLOAT sigma, int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrix(n, nnz, A, irow, pcol);

  // Defining the eigenvalue problem.

  ARluNonSymStdEig<FLOAT> prob(nev, matrix, sigma, which, ncv,
                               tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigValR, EigValI);

} // real nonsymmetric standard problem, only eigenvalues, shift-and-invert.


template <class FLOAT>
int AREig(FLOAT EigValR[], FLOAT EigValI[], FLOAT EigVec[], int n, int nnz,
          FLOAT A[], int irow[], int pcol[], FLOAT sigma, int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0, int maxit = 0,
          FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrix(n, nnz, A, irow, pcol);

  // Defining the eigenvalue problem.

  ARluNonSymStdEig<FLOAT> prob(nev, matrix, sigma, which, ncv,
                               tol, maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigValR, EigValI);

} // real nonsymmetric standard problem, values and vectors, shift-and-invert.


template <class FLOAT>
int AREig(double EigValR[], FLOAT EigValI[], int n, int nnzA,
          FLOAT A[], int irowA[], int pcolA[], int nnzB,
          FLOAT B[], int irowB[], int pcolB[], int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluNonSymGenEig<FLOAT> prob(nev, matrixA, matrixB, which,
                               ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigValR, EigValI);

} // real nonsymmetric generalized problem, only eigenvalues, regular mode.


template <class FLOAT>
int AREig(float EigValR[], FLOAT EigValI[], int n, int nnzA,
          FLOAT A[], int irowA[], int pcolA[], int nnzB,
          FLOAT B[], int irowB[], int pcolB[], int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluNonSymGenEig<FLOAT> prob(nev, matrixA, matrixB, which,
                               ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigValR, EigValI);

} // real nonsymmetric generalized problem, only eigenvalues, regular mode.


template <class FLOAT>
int AREig(FLOAT EigValR[], FLOAT EigValI[], FLOAT EigVec[], int n,
          int nnzA, FLOAT A[], int irowA[], int pcolA[],
          int nnzB, FLOAT B[], int irowB[], int pcolB[],
          int nev, char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluNonSymGenEig<FLOAT> prob(nev, matrixA, matrixB, which,
                               ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigValR, EigValI);

} // real nonsymmetric generalized problem, values and vectors, regular mode.


template <class FLOAT>
int AREig(double EigValR[], FLOAT EigValI[], int n, int nnzA,
          FLOAT A[], int irowA[], int pcolA[], int nnzB,
          FLOAT B[], int irowB[], int pcolB[], FLOAT sigma,
          int nev, char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluNonSymGenEig<FLOAT> prob(nev, matrixA, matrixB, sigma, which,
                               ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigValR, EigValI);

} // real nonsymmetric generalized problem, only eigenvalues,
  // real shift-and-invert mode.


template <class FLOAT>
int AREig(float EigValR[], FLOAT EigValI[], int n, int nnzA,
          FLOAT A[], int irowA[], int pcolA[], int nnzB,
          FLOAT B[], int irowB[], int pcolB[], FLOAT sigma,
          int nev, char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluNonSymGenEig<FLOAT> prob(nev, matrixA, matrixB, sigma, which,
                               ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigValR, EigValI);

} // real nonsymmetric generalized problem, only eigenvalues,
  // real shift-and-invert mode.


template <class FLOAT>
int AREig(FLOAT EigValR[], FLOAT EigValI[], FLOAT EigVec[], int n,
          int nnzA, FLOAT A[], int irowA[], int pcolA[], int nnzB,
          FLOAT B[], int irowB[], int pcolB[], FLOAT sigma, int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluNonSymGenEig<FLOAT> prob(nev, matrixA, matrixB, sigma, which,
                               ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigValR, EigValI);

} // real nonsymmetric generalized problem, values and vectors,
  // real shift-and-invert mode.


template <class FLOAT>
int AREig(FLOAT EigValR[], FLOAT EigValI[], int n, int nnzA, FLOAT A[],
          int irowA[], int pcolA[], int nnzB, FLOAT B[], int irowB[],
          int pcolB[], char part, FLOAT sigmaR, FLOAT sigmaI,
          int nev, char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluNonSymGenEig<FLOAT> prob(nev, matrixA, matrixB, part,
                               sigmaR, sigmaI, which, ncv,
                               tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigValR, EigValI);

} // real nonsymmetric generalized problem, only eigenvalues,
  // complex shift-and-invert mode.


template <class FLOAT>
int AREig(FLOAT EigValR[], FLOAT EigValI[], FLOAT EigVec[], int n, int nnzA,
          FLOAT A[], int irowA[], int pcolA[], int nnzB, FLOAT B[],
          int irowB[], int pcolB[], char part, FLOAT sigmaR, FLOAT sigmaI,
          int nev, char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluNonSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA);
  ARluNonSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB);

  // Defining the eigenvalue problem.

  ARluNonSymGenEig<FLOAT> prob(nev, matrixA, matrixB, part,
                               sigmaR, sigmaI, which, ncv,
                               tol, maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigValR, EigValI);

} // real nonsymmetric generalized problem, values and vectors,
  // complex shift-and-invert mode.


template <class FLOAT>
int AREig(FLOAT EigVal[], int n, int nnz, FLOAT A[], int irow[],
          int pcol[], char uplo, int nev, char* which = "LM",
          int ncv = 0, FLOAT tol = 0.0, int maxit = 0,
          FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluSymMatrix<FLOAT> matrix(n, nnz, A, irow, pcol, uplo);

  // Defining the eigenvalue problem.

  ARluSymStdEig<FLOAT> prob(nev, matrix, which, ncv, tol,
                            maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigVal);

} // real symmetric standard problem, only eigenvalues, regular mode.


template <class FLOAT>
int AREig(FLOAT EigVal[], FLOAT EigVec[], int n, int nnz, FLOAT A[],
          int irow[], int pcol[], char uplo, int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluSymMatrix<FLOAT> matrix(n, nnz, A, irow, pcol, uplo);

  // Defining the eigenvalue problem.

  ARluSymStdEig<FLOAT> prob(nev, matrix, which, ncv, tol,
                            maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigVal);

} // real symmetric standard problem, values and vectors, regular mode.


template <class FLOAT>
int AREig(FLOAT EigVal[], int n, int nnz, FLOAT A[], int irow[],
          int pcol[], char uplo, FLOAT sigma, int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluSymMatrix<FLOAT> matrix(n, nnz, A, irow, pcol, uplo);

  // Defining the eigenvalue problem.

  ARluSymStdEig<FLOAT> prob(nev, matrix, sigma, which, ncv,
                            tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigVal);

} // real symmetric standard problem, only eigenvalues, shift-and-invert.


template <class FLOAT>
int AREig(FLOAT EigVal[], FLOAT EigVec[], int n, int nnz, FLOAT A[],
          int irow[], int pcol[], char uplo, FLOAT sigma,
          int nev, char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating a matrix in ARPACK++ format.

  ARluSymMatrix<FLOAT> matrix(n, nnz, A, irow, pcol, uplo);

  // Defining the eigenvalue problem.

  ARluSymStdEig<FLOAT> prob(nev, matrix, sigma, which, ncv,
                            tol, maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigVal);

} // real symmetric standard problem, values and vectors, shift-and-invert.


template <class FLOAT>
int AREig(FLOAT EigVal[], int n, int nnzA, FLOAT A[], int irowA[],
          int pcolA[], int nnzB, FLOAT B[], int irowB[], int pcolB[],
          char uplo, int nev, char* which = "LM", int ncv = 0,
          FLOAT tol = 0.0, int maxit = 0, FLOAT* resid = 0,
          bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA, uplo);
  ARluSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB, uplo);

  // Defining the eigenvalue problem.

  ARluSymGenEig<FLOAT> prob(nev, matrixA, matrixB, which,
                            ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigVal);

} // real symmetric generalized problem, only eigenvalues, regular mode.


template <class FLOAT>
int AREig(FLOAT EigVal[], FLOAT EigVec[], int n, int nnzA, FLOAT A[],
          int irowA[], int pcolA[], int nnzB, FLOAT B[], int irowB[],
          int pcolB[], char uplo, int nev, char* which = "LM",
          int ncv = 0, FLOAT tol = 0.0, int maxit = 0,
          FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA, uplo);
  ARluSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB, uplo);

  // Defining the eigenvalue problem.

  ARluSymGenEig<FLOAT> prob(nev, matrixA, matrixB, which,
                            ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigVal);

} // real symmetric generalized problem, values and vectors, regular mode.


template <class FLOAT>
int AREig(FLOAT EigVal[], int n, int nnzA, FLOAT A[], int irowA[],
          int pcolA[], int nnzB, FLOAT B[], int irowB[], int pcolB[],
          char uplo, char InvertMode, FLOAT sigma, int nev,
          char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA, uplo);
  ARluSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB, uplo);

  // Defining the eigenvalue problem.

  ARluSymGenEig<FLOAT> prob(InvertMode, nev, matrixA, matrixB, sigma,
                            which, ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues.

  return prob.Eigenvalues(EigVal);

} // real symmetric generalized problem, only eigenvalues,
  // shift-and-invert, buckling and Cayley modes.


template <class FLOAT>
int AREig(FLOAT EigVal[], FLOAT EigVec[], int n, int nnzA, FLOAT A[],
          int irowA[], int pcolA[], int nnzB, FLOAT B[], int irowB[],
          int pcolB[], char uplo, char InvertMode, FLOAT sigma,
          int nev, char* which = "LM", int ncv = 0, FLOAT tol = 0.0,
          int maxit = 0, FLOAT* resid = 0, bool AutoShift = true)
{

  // Creating two matrices in ARPACK++ format.

  ARluSymMatrix<FLOAT> matrixA(n, nnzA, A, irowA, pcolA, uplo);
  ARluSymMatrix<FLOAT> matrixB(n, nnzB, B, irowB, pcolB, uplo);

  // Defining the eigenvalue problem.

  ARluSymGenEig<FLOAT> prob(InvertMode, nev, matrixA, matrixB, sigma,
                            which, ncv, tol, maxit, resid, AutoShift);

  // Finding eigenvalues and eigenvectors.

  return prob.EigenValVectors(EigVec, EigVal);

} // real symmetric generalized problem, values and vectors,
  // shift-and-invert, buckling and Cayley modes.


#endif // AREIG_H