Skip to content

coupling_matrix conjugates off-diagonal entries incorrectly for complex couplings #39

Description

@oameye

Summary

coupling_matrix agrees with the documented interaction-picture generator for real couplings, but conjugates the off-diagonal entries incorrectly when the couplings are complex.

For two cascaded modes with

$$G_i = (1, g_i^* a_i, 0),$$

the SLH Hamiltonian gives

$$A = \frac{1}{2} \begin{pmatrix} 0 & g_1 g_2^* \\\ -g_1^* g_2 & 0 \end{pmatrix}.$$

Minimal reproducer

using QuantumInputOutput

g1 = 1 + 2im
g2 = 3 + 4im
A = coupling_matrix((g1, g2))(0.0)

A_expected = 0.5 * [
  0                 g1 * conj(g2)
  -conj(g1) * g2    0
]

@assert A  A_expected

Current result:

ComplexF64[
  0.0 + 0.0im    5.5 - 1.0im
 -5.5 - 1.0im    0.0 + 0.0im
]

Expected result:

ComplexF64[
  0.0 + 0.0im    5.5 + 1.0im
 -5.5 + 1.0im    0.0 + 0.0im
]

Likely cause

The (i, j) indices constructed with divrem appear to be ordered as row-major entries, while the tuple passed to SMatrix is interpreted in column-major order. This effectively transposes the coefficient formula and conjugates the off-diagonal pair.

Impact

The current interaction-picture tests use real Gaussian pulse couplings, for which the mismatch is hidden. Complex temporal modes, for example chirped or detuned pulses, receive the wrong interaction-picture transformation.

Adding a test with non-real g1 and g2 should expose the regression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions