Skip to content

Commit

Permalink
Merge branch 'quantumlib:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
eliottrosenberg authored Jan 25, 2024
2 parents 69378cc + ee56c59 commit 091e434
Show file tree
Hide file tree
Showing 25 changed files with 36 additions and 326 deletions.
4 changes: 0 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ __pycache__
# packaging
*.egg-info/

# Sphinx
_build
rtd_docs/generated

# swap files
*.swp

Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,20 +185,6 @@ jobs:
- name: Test dependencies with pip-compile
run: |
pip-compile --resolver=backtracking dev_tools/requirements/deps/cirq-all.txt -o-
build_docs:
name: Build docs
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
architecture: 'x64'
- name: Install requirements
run: |
pip install -r rtd_docs/requirements.txt
- name: Build docs
run: dev_tools/docs/build-rtd-docs.sh
build_protos:
name: Build protos
runs-on: ubuntu-20.04
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ __pycache__
*.egg-info/
build/

# Sphinx
_build
rtd_docs/generated

# API docs
docs/api_docs

Expand Down
9 changes: 0 additions & 9 deletions .readthedocs.yml

This file was deleted.

4 changes: 0 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ circuits and running them against quantum computers and simulators.
.. image:: https://badge.fury.io/py/cirq.svg
:target: https://badge.fury.io/py/cirq

.. image:: https://readthedocs.org/projects/cirq/badge/?version=latest
:target: https://readthedocs.org/projects/cirq/versions/
:alt: Documentation Status


Installation and Documentation
------------------------------
Expand Down
12 changes: 8 additions & 4 deletions cirq-core/cirq/experiments/qubit_characterizations.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,9 @@ def _create_parallel_rb_circuit(
num_moments = max(len(sequence) for sequence in sequences_to_zip)
for q, sequence in zip(qubits, sequences_to_zip):
if (n := len(sequence)) < num_moments:
sequence.extend([ops.SingleQubitCliffordGate.I(q)] * (num_moments - n))
sequence.extend(
[ops.SingleQubitCliffordGate.I.to_phased_xz_gate()(q)] * (num_moments - n)
)
moments = zip(*sequences_to_zip)
return circuits.Circuit.from_moments(*moments, ops.measure_each(*qubits))

Expand Down Expand Up @@ -739,13 +741,15 @@ def _two_qubit_clifford_matrices(


def _random_single_q_clifford(
qubit: 'cirq.Qid', num_cfds: int, cfds: Sequence[Sequence['cirq.Gate']]
qubit: 'cirq.Qid', num_cfds: int, cfds: Sequence[Sequence['cirq.ops.SingleQubitCliffordGate']]
) -> List['cirq.Operation']:
clifford_group_size = 24
operations = [[gate(qubit) for gate in gates] for gates in cfds]
operations = [[gate.to_phased_xz_gate()(qubit) for gate in gates] for gates in cfds]
gate_ids = list(np.random.choice(clifford_group_size, num_cfds))
adjoint = _reduce_gate_seq([gate for gate_id in gate_ids for gate in cfds[gate_id]]) ** -1
return [op for gate_id in gate_ids for op in operations[gate_id]] + [adjoint(qubit)]
return [op for gate_id in gate_ids for op in operations[gate_id]] + [
adjoint.to_phased_xz_gate()(qubit)
]


def _random_two_q_clifford(
Expand Down
12 changes: 12 additions & 0 deletions cirq-core/cirq/experiments/qubit_characterizations_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,15 @@ def test_tomography_plot_raises_for_incorrect_number_of_axes():
with pytest.raises(ValueError):
_, axes = plt.subplots(1, 3)
result.plot(axes)


def test_single_qubit_cliffords_gateset():
qubits = [GridQubit(0, i) for i in range(4)]
clifford_group = cirq.experiments.qubit_characterizations._single_qubit_cliffords()
c = cirq.experiments.qubit_characterizations._create_parallel_rb_circuit(
qubits, 5, clifford_group.c1_in_xy
)
device = cirq.testing.ValidatingTestDevice(
qubits=qubits, allowed_gates=(cirq.ops.PhasedXZGate, cirq.MeasurementGate)
)
device.validate_circuit(c)
4 changes: 3 additions & 1 deletion cirq-google/cirq_google/serialization/circuit_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ def _serialize_gate_op(
out=msg.phasedxpowgate.exponent,
arg_function_language=arg_function_language,
)
elif isinstance(gate, cirq.PhasedXZGate):
elif isinstance(gate, (cirq.PhasedXZGate, cirq.ops.SingleQubitCliffordGate)):
if isinstance(gate, cirq.ops.SingleQubitCliffordGate):
gate = gate.to_phased_xz_gate()
arg_func_langs.float_arg_to_proto(
gate.x_exponent,
out=msg.phasedxzgate.x_exponent,
Expand Down
13 changes: 13 additions & 0 deletions cirq-google/cirq_google/serialization/circuit_serializer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,3 +668,16 @@ def test_measurement_gate_deserialize() -> None:
msg = cg.CIRCUIT_SERIALIZER.serialize(circuit)

assert cg.CIRCUIT_SERIALIZER.deserialize(msg) == circuit


def test_circuit_with_cliffords():
q = cirq.NamedQubit('q')
circuit = cirq.Circuit(
g(q) for g in cirq.ops.SingleQubitCliffordGate.all_single_qubit_cliffords
)
want = cirq.Circuit(
g.to_phased_xz_gate()(q)
for g in cirq.ops.SingleQubitCliffordGate.all_single_qubit_cliffords
)
msg = cg.CIRCUIT_SERIALIZER.serialize(circuit)
assert cg.CIRCUIT_SERIALIZER.deserialize(msg) == want
59 changes: 0 additions & 59 deletions dev_tools/docs/build-rtd-docs.sh

This file was deleted.

1 change: 0 additions & 1 deletion dev_tools/incremental_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

IGNORED_FILE_PATTERNS = [
r'^dev_tools/.+', # Environment-heavy code.
r'^rtd_docs/.+', # Environment-heavy code.
r'^.+_pb2(_grpc)?\.py$', # Auto-generated protobuf code.
r'^(.+/)?setup\.py$', # Installation code.
r'^(.+/)?_version\.py$', # Installation code.
Expand Down
3 changes: 0 additions & 3 deletions rtd_docs/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions rtd_docs/404.md

This file was deleted.

Binary file removed rtd_docs/Cirq_logo_color.png
Binary file not shown.
Binary file removed rtd_docs/Cirq_logo_notext.png
Binary file not shown.
20 changes: 0 additions & 20 deletions rtd_docs/Makefile

This file was deleted.

13 changes: 0 additions & 13 deletions rtd_docs/__init__.py

This file was deleted.

33 changes: 0 additions & 33 deletions rtd_docs/_templates/autosummary/class.rst

This file was deleted.

41 changes: 0 additions & 41 deletions rtd_docs/_templates/autosummary/module.rst

This file was deleted.

3 changes: 0 additions & 3 deletions rtd_docs/_templates/breadcrumbs.html

This file was deleted.

6 changes: 0 additions & 6 deletions rtd_docs/_templates/layout.html

This file was deleted.

Loading

0 comments on commit 091e434

Please sign in to comment.