Bug with `SelfAdjointEigenSolver..eigenvalues().asDiagonal()` on CUDA
Summary
While Eigen::SelfAdjointEigenSolver works fine on CUDA and the eigenvalues() method returns the right results, SelfAdjointEigenSolver.eigenvalues().asDiagonal() returns an all-zero matrix.
Environment
The bug shows up on both Windows and Ubuntu (under WSL)
- Operating System : Windows/Linux
- Architecture : x64
- Eigen Version : from master
- Compiler Version : VS 2022/NVCC 12.6 and GCC 11.4.0/NVCC 12.5
Minimal Example
The following code shows a minimal code for the bug https://github.com/Ahdhn/SelfAdjointEigenSolver
__global__ void kernel()
{
using MatT = Eigen::Matrix3f;
MatT H;
H << 1, 0, 0, //
0, 2, 0, //
0, 0, 3;
Eigen::SelfAdjointEigenSolver<MatT> eig(H);
printf("\n Eigenvalues: %f, %f, %f\n ",
eig.eigenvalues()[0],
eig.eigenvalues()[1],
eig.eigenvalues()[2]);
MatT D = eig.eigenvalues().asDiagonal();
printf("\n Eigenvalues as diag: %f, %f, %f\n ", D(0, 0), D(1, 1), D(2, 2));
}
Steps to reproduce
git clone https://github.com/Ahdhn/SelfAdjointEigenSolver.git
cd SelfAdjointEigenSolver
mkdir build
cd build
cmake ..
Depending on the system, this will generate either a .sln project on Windows or a make file for a Linux system.
What is the current bug behavior?
eig.eigenvalues().asDiagonal() returns/prints an all zero matrix.
What is the expected correct behavior?
eig.eigenvalues().asDiagonal() should return/print a diagonal matrix with 1,2,3 on the diagonal.
-
Have a plan to fix this issue.