qadence
qadence copied to clipboard
[Bug, DA] Limitations on `AnalogRX` due to the duration
Currently, it's impossible to kron
AnalogRX
blocks with different angles, because the duration directly depends on it:
kron(AnalogRX(torch.pi/4, qubit_support=0), kron(AnalogRX(torch.pi/2, qubit_support=1)))
# ValueError: Kron'ed blocks have to have same duration.
Same problem with values having identical absolute values but opposite signs:
kron(AnalogRX(torch.pi/4, qubit_support=0), kron(AnalogRX(-torch.pi/4, qubit_support=1)))
# ValueError: Kron'ed blocks have to have same duration.
Interestingly, a negative angle leads to a negative duration:
AnalogRX(-torch.pi/4, qubit_support=0)
# ConstantAnalogRotation(α=-0.785398163397448, t=-250.000000000000, support=(0,), Ω=3.14159265358979, δ=0, φ=0)
In _analog_rot
definition, there's a comment about it, so adjust the amplitude instead of the duration:
# FIXME: once https://gitlab.pasqal.com/pqs/qadence/-/issues/402 is fixed set default duration
# in the function arguments to:
# duration = Parameter(160)
# and compute omega like this:
# omega = alpha / duration * 1000
But the issue's link doesn't exist, so this one can serve as a replacement.
Actually, @CdeTerra is there a reason why you have these inner kron operations ?
Actually, @CdeTerra is there a reason why you have these inner kron operations ?
No, it's simply a mistake, the code I intended is:
kron(AnalogRX(torch.pi/4, qubit_support=0), AnalogRX(torch.pi/2, qubit_support=1))
kron(AnalogRX(torch.pi/4, qubit_support=0), AnalogRX(-torch.pi/4, qubit_support=1))
Actually, @CdeTerra is there a reason why you have these inner kron operations ?
No, it's simply a mistake, the code I intended is:
kron(AnalogRX(torch.pi/4, qubit_support=0), AnalogRX(torch.pi/2, qubit_support=1)) kron(AnalogRX(torch.pi/4, qubit_support=0), AnalogRX(-torch.pi/4, qubit_support=1))
Right, but the error still raises ?
Yes, it does
@jpmoutinho Still relevant ?
Yes, to be closed after handling #226 and #87