PauliMeasurementGate fails to construct when given an empty observable

Open
#6,136 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@koppolusivanagaraju is already working on this.

Since Oct 11, 2026.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python

Research direction

Start by reading the PauliMeasurementGate and DensePauliString entry points, then find and run their existing tests. Check the empty-string cases in the example, including the negated observable. Done when both construct without raising and sampling gives a=0 and b=1.

Written by the indexing model from the issue text.

Description

kind/bug-report status/needs-agreed-design triage/accepted

The following should not raise an exception. It should produce a circuit which, when sampled, samples a=0 and b=1.

import cirq
circuit = cirq.Circuit(
    cirq.PauliMeasurementGate(cirq.DensePauliString(""), key="a").on(),
    cirq.PauliMeasurementGate(-cirq.DensePauliString(""), key="b").on(),
)

Failing to measure the empty pauli string is sort of like failing to search for matches to the empty string. It's a corner case but it should still work.

Dominant language
Python
Stars
5.1k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
48

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from quantumlib/Cirq

All issues in quantumlib/Cirq

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.