Skip to content

Instantiation with controlled VariableUnitaryGate #310

@martinanibbi

Description

@martinanibbi

I would like to use instatiation on a parametrized circuit which includes controlled operations:

circuit = Circuit(4)
V1 = VariableUnitaryGate(3)
# control on 0
circuit.append_gate(ControlledGate(V1, num_controls=1), [0,1,2,3])

circuit.instantiate(
            unitary,
            method='qfactor',
            diff_tol_a=1e-12,   # Stopping criteria for distance change
            diff_tol_r=1e-10,    # Relative criteria for distance change
            dist_tol=1e-12,     # Stopping criteria for distance
            max_iters=100000,   # Maximum number of iterations
            min_iters=1000,     # Minimum number of iterations
            slowdown_factor=0,   # Larger numbers slowdown optimization
            # to avoid local minima
        )

I currently get the following error:

Cannot instantiate circuit with qfactor because the following gates are not locally optimizable: Controlled(VariableUnitaryGate(3, (2, 2, 2))).

When using minimization the code produces a similar error.

From my understanding, the problem is that ControlledGate is not a LocallyOptimizableUnitary.
Is there a way to circumnavigate this issue, is it a missing feature or is it simply impossible to use controlled parametrized gates with the instantiation method?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions