Skip to content

Update QasmUGate to support symbols in parameters.  #5985

Open
@ArfatSalman

Description

@ArfatSalman

Description of the issue
assert_circuits_with_terminal_measurements_are_equivalent throws an error when a QasmUGate uses a Symbol parameter.

How to reproduce the issue

import cirq
from sympy import Symbol
from cirq.circuits.qasm_output import QasmUGate
import numpy as np


qr = [cirq.NamedQubit("q" + str(i)) for i in range(5)]

p_96fafa = Symbol("p_96fafa")

circuit = cirq.Circuit()

circuit.append(
    QasmUGate(5.887184334931191 / np.pi, p_96fafa / np.pi, 1.4112277317699358 / np.pi)(
        qr[4]
    )
)


circuit = cirq.resolve_parameters(
    circuit,
    {
        "p_96fafa": 0.07157463504881167,
    },
)

cirq.testing.assert_circuits_with_terminal_measurements_are_equivalent(circuit, circuit)
# TypeError: cirq.apply_unitaries failed. There was a non-unitary value in the `unitary_values` list.

put long logs in details blocks like this

Cirq version
You can get the cirq version by printing cirq.__version__. From the command line:

1.1.0

Metadata

Metadata

Assignees

Labels

area/gatesarea/interoparea/parametersparameter resolution, parameterized gates, operationsarea/qasmgood first issueThis issue can be resolved by someone who is not familiar with the codebase. A good starting issue.good for learningFor beginners in QC, this will help picking up some knowledge. Bit harder than "good first issues"kind/bug-reportSomething doesn't seem to work.no QC knowledge neededWant to contribute to Cirq, but don't know quantum computing? This issue is for you.triage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked on

Type

No type

Projects

Status

No status

Relationships

None yet

Development

No branches or pull requests

Issue actions