28 bool computeEigenvectors) {
30 libmesh_assert(A.cols() == A.rows() &&
31 B.cols() == A.rows() &&
32 B.cols() == B.rows());
41 int n = (int)A.cols();
45 if (computeEigenvectors) {
78 *a_vals = Amat.data(),
79 *b_vals = Bmat.data(),
80 *alpha_r_v = aval_r.data(),
81 *alpha_i_v = aval_i.data(),
82 *beta_v = bval.data(),
83 *vecl_v = vecl.data(),
84 *vecr_v = vecr.data(),
85 *work_v = work.data();
91 &(alpha_r_v[0]), &(alpha_i_v[0]), &(beta_v[0]),
92 &(vecl_v[0]), &n, &(vecr_v[0]), &n,
97 unsigned int n_located = 0;
98 while (n_located < n) {
102 if (aval_i(n_located) != 0.) {
104 alpha( n_located) = std::complex<double>(aval_r(n_located), aval_i(n_located));
105 alpha(1+n_located) = std::complex<double>(aval_r(n_located), -aval_i(n_located));
106 beta ( n_located) = bval(n_located);
107 beta (1+n_located) = bval(n_located);
110 if (computeEigenvectors) {
112 std::complex<double> iota = std::complex<double>(0, 1.);
114 VL.col( n_located) = (vecl.col( n_located).cast<
Complex>() +
115 vecl.col(1+n_located).cast<
Complex>() * iota);
116 VL.col(1+n_located) = (vecl.col( n_located).cast<
Complex>() -
117 vecl.col(1+n_located).cast<
Complex>() * iota);
118 VR.col( n_located) = (vecr.col( n_located).cast<
Complex>() +
119 vecr.col(1+n_located).cast<
Complex>() * iota);
120 VR.col(1+n_located) = (vecr.col( n_located).cast<
Complex>() -
121 vecr.col(1+n_located).cast<
Complex>() * iota);
129 alpha( n_located) = std::complex<double>(aval_r(n_located), 0.);
130 beta ( n_located) = bval(n_located);
133 if (computeEigenvectors) {
135 VL.col(n_located) = vecl.col(n_located).cast<
Complex>();
136 VR.col(n_located) = vecr.col(n_located).cast<
Complex>();
146 <<
"Warning!! DGGEV returned with nonzero info = "
const RealMatrixX & B() const
Matrix< Real, Dynamic, Dynamic > RealMatrixX
Matrix< Real, Dynamic, 1 > RealVectorX
const RealMatrixX & A() const
void compute(const RealMatrixX &A, const RealMatrixX &B, bool computeEigenvectors=true)
computes the eigensolution for .
int dggev_(char *jobvl, char *jobvr, int *n, double *a, int *lda, double *b, int *ldb, double *alpha_r, double *alpha_i, double *beta, double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *lwork, int *info)