MAST
Multidisciplinary-design Adaptation and Sensitivity Toolkit (MAST)
lapack_zggev_interface.h
Go to the documentation of this file.
1 /*
2  * MAST: Multidisciplinary-design Adaptation and Sensitivity Toolkit
3  * Copyright (C) 2013-2020 Manav Bhatia and MAST authors
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #ifndef __mast__lapack_zggev_interface_h__
21 #define __mast__lapack_zggev_interface_h__
22 
23 
24 // MAST includes
25 #include "base/mast_data_types.h"
27 
28 
29 extern "C" {
30  /*
31  * =====================================================================
32  * Purpose
33  * =======
34  *
35  * ZGGEV computes for a pair of N-by-N complex nonsymmetric matrices
36  * (A,B), the generalized eigenvalues, and optionally, the left and/or
37  * right generalized eigenvectors.
38  *
39  * A generalized eigenvalue for a pair of matrices (A,B) is a scalar
40  * lambda or a ratio alpha/beta = lambda, such that A - lambda*B is
41  * singular. It is usually represented as the pair (alpha,beta), as
42  * there is a reasonable interpretation for beta=0, and even for both
43  * being zero.
44  *
45  * The right generalized eigenvector v(j) corresponding to the
46  * generalized eigenvalue lambda(j) of (A,B) satisfies
47  *
48  * A * v(j) = lambda(j) * B * v(j).
49  *
50  * The left generalized eigenvector u(j) corresponding to the
51  * generalized eigenvalues lambda(j) of (A,B) satisfies
52  *
53  * u(j)**H * A = lambda(j) * u(j)**H * B
54  *
55  * where u(j)**H is the conjugate-transpose of u(j).
56  *
57  * Arguments
58  * =========
59  *
60  * JOBVL (input) CHARACTER*1
61  * = 'N': do not compute the left generalized eigenvectors;
62  * = 'V': compute the left generalized eigenvectors.
63  *
64  * JOBVR (input) CHARACTER*1
65  * = 'N': do not compute the right generalized eigenvectors;
66  * = 'V': compute the right generalized eigenvectors.
67  *
68  * N (input) INTEGER
69  * The order of the matrices A, B, VL, and VR. N >= 0.
70  *
71  * A (input/output) COMPLEX*16 array, dimension (LDA, N)
72  * On entry, the matrix A in the pair (A,B).
73  * On exit, A has been overwritten.
74  *
75  * LDA (input) INTEGER
76  * The leading dimension of A. LDA >= max(1,N).
77  *
78  * B (input/output) COMPLEX*16 array, dimension (LDB, N)
79  * On entry, the matrix B in the pair (A,B).
80  * On exit, B has been overwritten.
81  *
82  * LDB (input) INTEGER
83  * The leading dimension of B. LDB >= max(1,N).
84  *
85  * ALPHA (output) COMPLEX*16 array, dimension (N)
86  * BETA (output) COMPLEX*16 array, dimension (N)
87  * On exit, ALPHA(j)/BETA(j), j=1,...,N, will be the
88  * generalized eigenvalues.
89  *
90  * Note: the quotients ALPHA(j)/BETA(j) may easily over- or
91  * underflow, and BETA(j) may even be zero. Thus, the user
92  * should avoid naively computing the ratio alpha/beta.
93  * However, ALPHA will be always less than and usually
94  * comparable with norm(A) in magnitude, and BETA always less
95  * than and usually comparable with norm(B).
96  *
97  * VL (output) COMPLEX*16 array, dimension (LDVL,N)
98  * If JOBVL = 'V', the left generalized eigenvectors u(j) are
99  * stored one after another in the columns of VL, in the same
100  * order as their eigenvalues.
101  * Each eigenvector is scaled so the largest component has
102  * abs(real part) + abs(imag. part) = 1.
103  * Not referenced if JOBVL = 'N'.
104  *
105  * LDVL (input) INTEGER
106  * The leading dimension of the matrix VL. LDVL >= 1, and
107  * if JOBVL = 'V', LDVL >= N.
108  *
109  * VR (output) COMPLEX*16 array, dimension (LDVR,N)
110  * If JOBVR = 'V', the right generalized eigenvectors v(j) are
111  * stored one after another in the columns of VR, in the same
112  * order as their eigenvalues.
113  * Each eigenvector is scaled so the largest component has
114  * abs(real part) + abs(imag. part) = 1.
115  * Not referenced if JOBVR = 'N'.
116  *
117  * LDVR (input) INTEGER
118  * The leading dimension of the matrix VR. LDVR >= 1, and
119  * if JOBVR = 'V', LDVR >= N.
120  *
121  * WORK (workspace/output) COMPLEX*16 array, dimension (MAX(1,LWORK))
122  * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
123  *
124  * LWORK (input) INTEGER
125  * The dimension of the array WORK. LWORK >= max(1,2*N).
126  * For good performance, LWORK must generally be larger.
127  *
128  * If LWORK = -1, then a workspace query is assumed; the routine
129  * only calculates the optimal size of the WORK array, returns
130  * this value as the first entry of the WORK array, and no error
131  * message related to LWORK is issued by XERBLA.
132  *
133  * RWORK (workspace/output) DOUBLE PRECISION array, dimension (8*N)
134  *
135  * INFO (output) INTEGER
136  * = 0: successful exit
137  * < 0: if INFO = -i, the i-th argument had an illegal value.
138  * =1,...,N:
139  * The QZ iteration failed. No eigenvectors have been
140  * calculated, but ALPHA(j) and BETA(j) should be
141  * correct for j=INFO+1,...,N.
142  * > N: =N+1: other then QZ iteration failed in DHGEQZ,
143  * =N+2: error return from DTGEVC.
144  *
145  * =====================================================================
146  */
147  extern int zggev_(char* jobvl,
148  char* jobvr,
149  int* n,
150  std::complex<double>* a,
151  int* lda,
152  std::complex<double>* b,
153  int* ldb,
154  std::complex<double>* alpha,
155  std::complex<double>* beta,
156  std::complex<double>* vl,
157  int* ldvl,
158  std::complex<double>* vr,
159  int* ldvr,
160  std::complex<double>* work,
161  int* lwork,
162  double* rwork,
163  int* info);
164 
165 }
166 
167 
168 namespace MAST {
169 
172 
173  public:
174 
177  { }
178 
183  virtual void compute(const ComplexMatrixX& A,
184  const ComplexMatrixX& B,
185  bool computeEigenvectors = true);
186 
187  };
188 }
189 
190 
191 
192 #endif // __mast__lapack_zggev_interface_h__
const ComplexMatrixX & B() const
virtual void compute(const ComplexMatrixX &A, const ComplexMatrixX &B, bool computeEigenvectors=true)
computes the eigensolution for .
const ComplexMatrixX & A() const
Matrix< Complex, Dynamic, Dynamic > ComplexMatrixX
int zggev_(char *jobvl, char *jobvr, int *n, std::complex< double > *a, int *lda, std::complex< double > *b, int *ldb, std::complex< double > *alpha, std::complex< double > *beta, std::complex< double > *vl, int *ldvl, std::complex< double > *vr, int *ldvr, std::complex< double > *work, int *lwork, double *rwork, int *info)