Skip to content

PCVL-1147 support for coherent light inputs - #745

Open
Aubaert wants to merge 8 commits into
Quandela:developfrom
Aubaert:PCVL-1147-support-for-coherent-light-inputs
Open

PCVL-1147 support for coherent light inputs#745
Aubaert wants to merge 8 commits into
Quandela:developfrom
Aubaert:PCVL-1147-support-for-coherent-light-inputs

Conversation

@Aubaert

@Aubaert Aubaert commented May 25, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@jeonghoon-ad

Copy link
Copy Markdown

CoherentState.__ne__ currently recurses:

def __ne__(self, other: CoherentState) -> bool:
    return not self != other

So any != comparison raises RecursionError:

CoherentState([1]) != CoherentState([2])

Local check on this PR branch:

eq_same True
eq_diff False
ne_diff_error RecursionError maximum recursion depth exceeded
ne_same_error RecursionError maximum recursion depth exceeded

A direct fix is:

def __ne__(self, other: CoherentState) -> bool:
    return not self == other

A regression test can cover both equal and non-equal states:

assert not (CoherentState([1]) != CoherentState([1]))
assert CoherentState([1]) != CoherentState([2])

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants