ket.quforge¶
QuForge Interface for Ket
The class QuForgeKet
enables the use of QuForge, an efficient
qudit simulator, within Ket. This simulator supports expected value calculation
and gradient evaluation, making it a great choice for Quantum Machine Learning.
This module requires additional dependencies from ket-lang[qml]
.
Install with: pip install ket-lang[qml]
.
Classes ket.quforge
¶
QuForge Interface for Ket |
- class QuForgeKet(num_qubits: int, device: Literal['cpu', 'cuda'] = 'cpu', sparse: bool = True, gradient: bool = True)¶
QuForge Interface for Ket
This simulator supports expected value calculation and gradient evaluation, making it a great choice for Quantum Machine Learning.
- Parameters:
num_qubits – Number of qubits to simulate.
device – Specifies whether to run the simulation on the CPU or GPU. Defaults to “cpu”.
sparse – If True, uses a sparse representation for improved performance on large systems. Defaults to True.
gradient – Enables gradient evaluation for optimization tasks. Defaults to True.
- pauli_x(target, control)¶
Apply a Pauli-X gate to the target qubit.
Warning
This method is called by Libket and should not be called directly.
- pauli_y(target, control)¶
Apply a Pauli-Y gate to the target qubit.
Warning
This method is called by Libket and should not be called directly.
- pauli_z(target, control)¶
Apply a Pauli-Z gate to the target qubit.
Warning
This method is called by Libket and should not be called directly.
- hadamard(target, control)¶
Apply a Hadamard gate to the target qubit.
Warning
This method is called by Libket and should not be called directly.
- rotation_x(target, control, **kwargs)¶
Apply a X-Rotation gate to the target qubit.
Warning
This method is called by Libket and should not be called directly.
- rotation_y(target, control, **kwargs)¶
Apply a Y-Rotation gate to the target qubit.
Warning
This method is called by Libket and should not be called directly.
- rotation_z(target, control, **kwargs)¶
Apply a Z-Rotation gate to the target qubit.
Warning
This method is called by Libket and should not be called directly.
- phase(target, control, **kwargs)¶
Apply a Phase gate to the target qubit.
Warning
This method is called by Libket and should not be called directly.
- exp_value(_, hamiltonian)¶
Compute the expectation value.
Warning
This method is called by Libket and should not be called directly.
- submit_execution(circuit, parameters)¶
Get the quantum circuit to execute.
Warning
This method is called by Libket and should not be called directly.
- get_result()¶
Get the result of the quantum circuit execution.
Warning
This method is called by Libket and should not be called directly.
- clear()¶
Clear the data to start a new execution.
Warning
This method is called by Libket and should not be called directly.