我需要获得一般复杂矩阵的特征向量,但精度为四倍。有人知道这样做的方法吗?
我目前使用 Tux Eigen,我看到在它们不受支持的模块中,它们使用 MPFR C++ 提供任意精度,但这似乎仅适用于实数。也许这可以以某种方式扩展到复数?
提前致谢
我需要获得一般复杂矩阵的特征向量,但精度为四倍。有人知道这样做的方法吗?
我目前使用 Tux Eigen,我看到在它们不受支持的模块中,它们使用 MPFR C++ 提供任意精度,但这似乎仅适用于实数。也许这可以以某种方式扩展到复数?
提前致谢
事实证明,在 Tux Eigen 中使用 MPFR C++ 复数相当简单。
#include <iostream>
#include <cmath>
#include <Eigen/Dense>
#include <Eigen/Eigenvalues>
#include <Eigen/LU>
#include <unsupported/Eigen/MPRealSupport>
#include <iomanip>
using namespace Eigen;
using namespace std;
using namespace mpfr;
int main(){
// set precision to 128 bits (double has only 53 bits)
mpreal::set_default_prec(128);
typedef Matrix<complex<mpreal>, Dynamic, Dynamic> MatrixXcmp;
MatrixXcmp C = MatrixXcmp::Random(8,8);
ComplexEigenSolver<MatrixXcmp> ces;
ces.compute(C);
return 0;
}
首先需要获得 MPFR C++,可在http://www.holoborodko.com/pavel/mpfr/#download获得,这取决于在https://www.mpfr.org/mpfr-current/#download中获得的 MPFR转取决于https://gmplib.org/#DOWNLOAD上提供的 GMP
然后代码需要与-lgmp和-lmpfr链接。