27 bool computeEigenvectors) {
29 libmesh_assert(A.cols() == A.rows());
36 int n = (int)A.cols();
40 if (computeEigenvectors) {
69 *a_vals = Amat.data(),
72 *vecl_v = vecl.data(),
73 *vecr_v = vecr.data(),
74 *work_v = work.data();
79 &(w_r_v[0]), &(w_i_v[0]),
80 &(vecl_v[0]), &n, &(vecr_v[0]), &n,
85 unsigned int n_located = 0;
86 while (n_located < n) {
90 if (w_i(n_located) != 0.) {
92 W( n_located) = std::complex<double>(w_r(n_located), w_i(n_located));
93 W(1+n_located) = std::complex<double>(w_r(n_located), -w_i(n_located));
96 if (computeEigenvectors) {
98 std::complex<double> iota = std::complex<double>(0, 1.);
100 VL.col( n_located) = (vecl.col( n_located).cast<
Complex>() +
101 vecl.col(1+n_located).cast<
Complex>() * iota);
102 VL.col(1+n_located) = (vecl.col( n_located).cast<
Complex>() -
103 vecl.col(1+n_located).cast<
Complex>() * iota);
104 VR.col( n_located) = (vecr.col( n_located).cast<
Complex>() +
105 vecr.col(1+n_located).cast<
Complex>() * iota);
106 VR.col(1+n_located) = (vecr.col( n_located).cast<
Complex>() -
107 vecr.col(1+n_located).cast<
Complex>() * iota);
115 W( n_located) = std::complex<double>(w_r(n_located), 0.);
118 if (computeEigenvectors) {
120 VL.col(n_located) = vecl.col(n_located).cast<
Complex>();
121 VR.col(n_located) = vecr.col(n_located).cast<
Complex>();
131 <<
"Warning!! DGEEV returned with nonzero info = "
void dgeev_(const char *jobvl, const char *jobvr, int *n, double *a, int *lda, double *w_r, double *w_i, double *vl, int *ldvl, double *vr, int *ldvr, double *work, int *lwork, int *info)
Matrix< Real, Dynamic, Dynamic > RealMatrixX
void compute(const RealMatrixX &A, bool computeEigenvectors=true)
computes the eigensolution for .
Matrix< Real, Dynamic, 1 > RealVectorX
const RealMatrixX & A() const