pasqal-io / qadence

Digital-analog quantum programming interface
https://pasqal-io.github.io/qadence/latest/
Apache License 2.0
70 stars 21 forks source link

Implement constructor function for alternating layer ansatz #532

Closed ducthanh1991 closed 1 month ago

ducthanh1991 commented 2 months ago

Hello,

Have you considered implementing a function to construct the alternating layer ansatz defined in the papers of Nakaji et al. and Cerezo et al. that would be similar to the existing hea function of the module qadence.constructors.ansatze?

chMoussa commented 2 months ago

Hi @ducthanh1991, we have not considered until you asked. It is probably a matter of changing slightly the support where a layer is applied with modulo repetitions, right?

ducthanh1991 commented 2 months ago

Hello @chMoussa,

Yes, I guess that one would need to specify all the same parameters as for the hea function plus one additional parameter for the size of the support of the "local" block in the alternating layer ansatz.

something like:

ansatz = alt_digital(
        depth=`4,
        n_qubits=12,
        m_qubits_block=4,
        operations=[RX],
        entangler=CNOT,
        )
display(ansatz,size="15,15")

would yield: image

chMoussa commented 2 months ago

Hello @chMoussa,

Yes, I guess that one would need to specify all the same parameters as for the hea function plus one additional parameter for the size of the support of the "local" block in the alternating layer ansatz.

something like:

ansatz = alt_digital(
        depth=`4,
        n_qubits=12,
        m_qubits_block=4,
        operations=[RX],
        entangler=CNOT,
        )
display(ansatz,size="15,15")

would yield: image

Ok I will see what is possible to do with the current implementation, unless you already have something on your side?

ducthanh1991 commented 2 months ago

Hello @chMoussa,

Yes I do have something that I wrote. I'll work on it during the weekend and make a pull request.

ducthanh1991 commented 1 month ago

Hi @chMoussa,

I have created the pull request #565. Could you take a look?

chMoussa commented 1 month ago

Closes with #565