本文整理汇总了C++中teuchos::LAPACK::GEEV方法的典型用法代码示例。如果您正苦于以下问题:C++ LAPACK::GEEV方法的具体用法?C++ LAPACK::GEEV怎么用?C++ LAPACK::GEEV使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::LAPACK
的用法示例。
在下文中一共展示了LAPACK::GEEV方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: levecs
int MxDimMatrix<T, DIM>::eig(MxDimVector<std::complex<T>, DIM> & evals,
MxDimMatrix<std::complex<T>, DIM> & levecs,
MxDimMatrix<std::complex<T>, DIM> & revecs) const {
MxDimMatrix<T, DIM> thisT = this->transpose();
MxDimVector<T, DIM> rva, iva;
MxDimMatrix<T, DIM> rve, lve;
int info;
int lwork = 5 * DIM;
T work[lwork];
Teuchos::LAPACK<int, T> lapack;
lapack.GEEV('V', 'V', DIM, &thisT(0, 0), DIM, &rva[0], &iva[0], &lve(0, 0), DIM, &rve(0, 0), DIM, work, lwork, &info);
if (info != 0)
std::cout << "MxDimMatrix::eig(): error in lapack routine. Return code: " << info << ".\n";
// gather results
for (size_t i = 0; i < DIM; ++i) {
if (iva[i] != 0) {
for (size_t k = 0; k < 2; ++k) {
evals[i + k].real() = rva[i + k];
evals[i + k].imag() = iva[i + k];
for (size_t j = 0; j < DIM; ++j) {
levecs(i + k, j).real() = lve(j, i);
levecs(i + k, j).imag() = (k == 0 ? 1.0 : -1.0) * lve(j, i + 1);
revecs(i + k, j).real() = rve(j, i);
revecs(i + k, j).imag() = (k == 0 ? 1.0 : -1.0) * rve(j, i + 1);
}
}
i++;
}
else {
evals[i].real() = rva[i];
evals[i].imag() = iva[i];
for (size_t j = 0; j < DIM; ++j) {
levecs(i, j).real() = lve(j, i);
revecs(i, j).real() = rve(j, i);
}
}
}
return info;
}