You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, cudaq.kernels does not support the hardware-efficient ansatz (HWE), which is valuable for variational quantum algorithms like VQE in reducing computation and simulation costs. Although HWE is included in this directory, it cannot be used.
To be precise, cudaq.kernels.hwe is accessible, but subsequent cudaq.observe call will raise an error: RuntimeError: hwe is not a valid kernel to call (cudaq.kernels).
and CUDA-Q built-in optimizers can not be used accordingly.
A simple modified version with JIT decorator (aligning to uccsd):
@cudaq.kernel
def hwe(qubits:cudaq.qview, numQubits:int, numLayers:int, parameters:list[float]):
"""
Generate the hardware-efficient CUDA-Q kernel.
Args:
qubits (:class:`qview`): Pre-allocated qubits
`numQubits` (int): Number of qubits
`numLayers` (int): Number of layers
parameters (List[float]): The list of parameters
"""
cnotCoupling = [[int(i), int(i+1)] for i in range(numQubits - 1)]
thetaCounter = 0
for i in range(numQubits):
ry(parameters[thetaCounter], qubits[i])
rz(parameters[thetaCounter + 1], qubits[i])
thetaCounter = thetaCounter + 2
for i in range(numLayers):
for cnot in cnotCoupling:
cx(qubits[cnot[0]], qubits[cnot[1]])
for q in range(numQubits):
ry(parameters[thetaCounter], qubits[q])
rz(parameters[thetaCounter + 1], qubits[q])
thetaCounter += 2
The text was updated successfully, but these errors were encountered:
Required prerequisites
Describe the feature
A related issue was being tracked here #361.
Currently,
cudaq.kernels
does not support the hardware-efficient ansatz (HWE), which is valuable for variational quantum algorithms like VQE in reducing computation and simulation costs. Although HWE is included in this directory, it cannot be used.To be precise,
cudaq.kernels.hwe
is accessible, but subsequentcudaq.observe call
will raise an error:RuntimeError: hwe is not a valid kernel to call (cudaq.kernels).
and CUDA-Q built-in optimizers can not be used accordingly.
A simple modified version with JIT decorator (aligning to uccsd):
The text was updated successfully, but these errors were encountered: