访问特征值

Access eigenvalues

我正在尝试获得协方差矩阵的最小特征值和特征向量:

    Eigen::Matrix3d covariance_matrix; //has to be Matrix3d
    double minEigenValue = 0;
    int minEigenVectorIndex = 0;
    //compute covariance matrix
    Eigen::EigenSolver<Eigen::Matrix3d > solver(covariance_matrix);
    Eigen::Matrix eigenvalues = solver.eigenvalues();
    // Eigen::Matrix3d eigenvalues = solver.eigenvalues(); results in an error
    for(int i = 0; i < 3;i++)
    {
//How do I access the eigenvalues? This fails. eigenvalues[0][i] also fails
        if(eigenvalues(0,i) > minEigenValue) 
        {
            minEigenValue = eigenvalues(0,i);
            minEigenVectorIndex = i;
        }
    }
    // somehow get pair of vector[0], vector[1], vector[2]: 
   //solver.eigenvectors().col(minEigenVectorIndex);

我已经通读了很多文档,但找不到明确的示例/解释 如何访问特征向量和值?

Eigen::Matrix<std::complex<double>,3,1> eigenvalues = solver.eigenvalues(); Eigen::Matrix<std::complex<double>,3,3> eigenvec = solver.eigenvectors();