1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2005-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING.  If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if ! defined (octave_eigs_base_h)
27 #define octave_eigs_base_h 1
28 
29 #include "octave-config.h"
30 
31 #include <iosfwd>
32 #include <string>
33 
34 #include "oct-cmplx.h"
35 
36 class ColumnVector;
37 class ComplexColumnVector;
38 class Matrix;
39 class ComplexMatrix;
40 
41 typedef ColumnVector (*EigsFunc) (const ColumnVector& x, int& eigs_error);
42 
43 typedef ComplexColumnVector (*EigsComplexFunc) (const ComplexColumnVector& x,
44                                                 int& eigs_error);
45 
46 template <typename M>
47 octave_idx_type
48 EigsRealSymmetricMatrix (const M& m, const std::string typ,
49                          octave_idx_type k, octave_idx_type p,
50                          octave_idx_type& info, Matrix& eig_vec,
51                          ColumnVector& eig_val, const M& _b,
52                          ColumnVector& permB, ColumnVector& resid,
53                          std::ostream& os, double tol, bool rvec,
54                          bool cholB, int disp, int maxit);
55 
56 template <typename M>
57 octave_idx_type
58 EigsRealSymmetricMatrixShift (const M& m, double sigma,
59                               octave_idx_type k, octave_idx_type p,
60                               octave_idx_type& info, Matrix& eig_vec,
61                               ColumnVector& eig_val, const M& _b,
62                               ColumnVector& permB, ColumnVector& resid,
63                               std::ostream& os, double tol, bool rvec,
64                               bool cholB, int disp, int maxit);
65 
66 template <typename M>
67 extern OCTAVE_API octave_idx_type
68 EigsRealSymmetricFunc (EigsFunc fun, octave_idx_type n,
69                        const std::string& _typ, double sigma,
70                        octave_idx_type k, octave_idx_type p,
71                        octave_idx_type& info, Matrix& eig_vec,
72                        ColumnVector& eig_val, const M& _b,
73                        ColumnVector& permB, ColumnVector& resid,
74                        std::ostream& os, double tol, bool rvec,
75                        bool cholB, int disp, int maxit);
76 
77 template <typename M>
78 octave_idx_type
79 EigsRealNonSymmetricMatrix (const M& m, const std::string typ,
80                             octave_idx_type k, octave_idx_type p,
81                             octave_idx_type& info, ComplexMatrix& eig_vec,
82                             ComplexColumnVector& eig_val, const M& _b,
83                             ColumnVector& permB, ColumnVector& resid,
84                             std::ostream& os, double tol, bool rvec,
85                             bool cholB, int disp, int maxit);
86 
87 template <typename M>
88 octave_idx_type
89 EigsRealNonSymmetricMatrixShift (const M& m, double sigmar,
90                                  octave_idx_type k, octave_idx_type p,
91                                  octave_idx_type& info,
92                                  ComplexMatrix& eig_vec,
93                                  ComplexColumnVector& eig_val, const M& _b,
94                                  ColumnVector& permB, ColumnVector& resid,
95                                  std::ostream& os, double tol, bool rvec,
96                                  bool cholB, int disp, int maxit);
97 
98 template <typename M>
99 extern OCTAVE_API octave_idx_type
100 EigsRealNonSymmetricFunc (EigsFunc fun, octave_idx_type n,
101                           const std::string& _typ, double sigmar,
102                           octave_idx_type k, octave_idx_type p,
103                           octave_idx_type& info, ComplexMatrix& eig_vec,
104                           ComplexColumnVector& eig_val, const M& _b,
105                           ColumnVector& permB, ColumnVector& resid,
106                           std::ostream& os, double tol, bool rvec,
107                           bool cholB, int disp, int maxit);
108 
109 template <typename M>
110 octave_idx_type
111 EigsComplexNonSymmetricMatrix (const M& m, const std::string typ,
112                                octave_idx_type k, octave_idx_type p,
113                                octave_idx_type& info, ComplexMatrix& eig_vec,
114                                ComplexColumnVector& eig_val, const M& _b,
115                                ColumnVector& permB,
116                                ComplexColumnVector& cresid,
117                                std::ostream& os, double tol, bool rvec,
118                                bool cholB, int disp, int maxit);
119 
120 template <typename M>
121 octave_idx_type
122 EigsComplexNonSymmetricMatrixShift (const M& m, Complex sigma,
123                                     octave_idx_type k, octave_idx_type p,
124                                     octave_idx_type& info,
125                                     ComplexMatrix& eig_vec,
126                                     ComplexColumnVector& eig_val, const M& _b,
127                                     ColumnVector& permB,
128                                     ComplexColumnVector& cresid,
129                                     std::ostream& os, double tol, bool rvec,
130                                     bool cholB, int disp, int maxit);
131 
132 template <typename M>
133 extern OCTAVE_API octave_idx_type
134 EigsComplexNonSymmetricFunc (EigsComplexFunc fun, octave_idx_type n,
135                              const std::string& _typ, Complex sigma,
136                              octave_idx_type k, octave_idx_type p,
137                              octave_idx_type& info, ComplexMatrix& eig_vec,
138                              ComplexColumnVector& eig_val, const M& _b,
139                              ColumnVector& permB, ComplexColumnVector& cresid,
140                              std::ostream& os, double tol, bool rvec,
141                              bool cholB, int disp, int maxit);
142 
143 #endif
144