Skip to content

No support for symbolic parameters for MatrixGate (U-gate) #6810

Open
@vili-1

Description

Is your feature request related to a use case or problem? Please describe.
Cirq does not currently support symbolic parameters, such as sympy.Symbol, for the MatrixGate (U-gate). While symbolic parameters are supported in other gates like rx, ry, and rz, the same functionality is not available for custom gates using MatrixGate.
The error below is raised when attempting to simulate the circuit with a symbolic parameter:

TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule 'safe'.

Describe the solution you'd like
Expected that Cirq would handle symbolic parameters in the MatrixGate and allow for symbolic computation during simulation, just as it does with gates like rx, ry, and rz. Qiskit handles symbolic parameters using its Parameter() class, including for U-gates.

[optional] Describe alternatives/workarounds you've considered

[optional] Additional context (e.g. screenshots)

What is the urgency from your perspective for this issue? Is it blocking important work?

P3 - I'm not really blocked by it, it is an idea I'd like to discuss / suggestion based on principle

Metadata

Assignees

No one assigned

    Labels

    kind/feature-requestDescribes new functionalitytriage/needs-more-evidence[Feature requests] Seems plausible, but maintainers are not convinced about the use cases yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions