espnet2.enh.layers.beamformer.generalized_eigenvalue_decomposition
Less than 1 minute
espnet2.enh.layers.beamformer.generalized_eigenvalue_decomposition
espnet2.enh.layers.beamformer.generalized_eigenvalue_decomposition(a: Tensor, b: Tensor, eps=1e-06)
Solves the generalized eigenvalue decomposition through Cholesky decomposition.
This function computes the generalized eigenvalue decomposition of matrices a and b, such that:
a @ e_vec = e_val * b @ e_vec
The method utilizes Cholesky decomposition on matrix b to transform the problem into a standard eigenvalue problem.
Steps involved:
- Perform Cholesky decomposition on b:
b = L @ L^H, where L is a lower triangular matrix.
- Define C = L^-1 @ a @ L^-H, which is Hermitian.
- Solve the eigenvalue problem C @ y = lambda * y.
- Obtain the eigenvectors e_vec = L^-H @ y.
Reference: https://www.netlib.org/lapack/lug/node54.html
- Parameters:
- a (torch.Tensor) – A complex Hermitian or real symmetric matrix whose eigenvalues and eigenvectors will be computed. Shape: (…, C, C).
- b (torch.Tensor) – A complex Hermitian or real symmetric definite positive matrix. Shape: (…, C, C).
- eps (float , optional) – A small value for numerical stability during Cholesky decomposition. Default is 1e-6.
- Returns:
- e_val (torch.Tensor): Generalized eigenvalues (ascending order).
- e_vec (torch.Tensor): Generalized eigenvectors.
- Return type: Tuple[torch.Tensor, torch.Tensor]
Examples
>>> a = torch.tensor([[1, 0], [0, 2]], dtype=torch.complex64)
>>> b = torch.tensor([[1, 0], [0, 1]], dtype=torch.complex64)
>>> e_val, e_vec = generalized_eigenvalue_decomposition(a, b)
>>> print(e_val)
>>> print(e_vec)
NOTE
The input matrices a and b must be Hermitian or symmetric as per the requirements of eigenvalue decomposition.