Qiskit / qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.
https://www.ibm.com/quantum/qiskit
Apache License 2.0
5.01k stars 2.32k forks source link

Should there be a parameterized initialize instruction? #5271

Open Cryoris opened 3 years ago

Cryoris commented 3 years ago

Should we allow something like

circuit = QuantumCircuit(n)
params = ParameterVector('th', 2 ** n)
circuit.initialize(params, range(n))

A possible use case would be using this circuit in machine learning algorithms as a reference kernel that doesn't do any quantum operations on the input data:

vqc = VQC(ansatz=RealAmplitudes(), data_encoding=circuit)

this is what the qiskit.aqua.components.feature_maps.RawFeatureVector does right now.

Though I'm not sure if such a feature should be contained to the machine learning applications or if we want to allow this in a more general setting.

kdk commented 3 years ago

I think this is a good idea, given that there's a solid use case for it and we already have gates that accept ParameterExpressions and can't be unrolled until fully bound (e.g. HamiltonianGate).

Cryoris commented 3 years ago

FYI, Qiskit ML introduced this in Qiskit/qiskit-machine-learning#21.

kdk commented 3 years ago

FYI, Qiskit ML introduced this in Qiskit/qiskit-machine-learning#21.

Is the plan to migrate this to terra, or should this be closed?

Cryoris commented 3 years ago

I think it should be migrated, we added it in ML because it was release critical 🙂