Skip to content

Bath Construction Fails for Coupling Ops with Degenerate Eigenvalues #165

Description

@sergleonov

Constructing an oqupy.Bath raises an AssertionError (line 77 in bath.py) when the system–bath coupling operator is Hermitian but has a 3 degenerate non-zero eigenvalues. Failing check is the following attempt to reconstruct the original matrix:

assert np.allclose(
    tmp_coupling_operator, self._unitary @ self._coupling_operator @ self._unitary.conjugate().T,
)

Currently, the coupling operator is diagonalised with a non-Hermitian eigensolver, which does not return an orthonormal eigenbasis within degenerate eigenspaces. As a result, U @ diag @ U† no longer reconstructs the original operator. Diagonalising with a Hermitian eigensolver (numpy.linalg.eigh) fixes it.

Minimal example

import numpy as np
import oqupy
def collective_sigma_x(n):
    # construct tensor product of sigma X operators for 3 TLSs
    sx = oqupy.operators.sigma("x")
    I = np.identity(2)
    total = np.zeros((2 ** n, 2 ** n), dtype=complex)
    for i in range(n):
        ops = [I for _ in range(n)]
        ops[i] = sx
        term = ops[0]
        for op in ops[1:]:
            term = np.kron(term, op)
        total += term
    return total

correlations = oqupy.PowerLawSD(
alpha=0.02, zeta=1, cutoff=0.5,
cutoff_type="exponential", temperature=0.5,
)

oqupy.Bath(collective_sigma_x(2), correlations) # works
oqupy.Bath(collective_sigma_x(3), correlations) # breaks, but can be fixed with eigh()

Environment

  • oqupy 0.5.0
  • numpy 2.x
  • Python 3.11

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions