PyQTorch
Fast differentiable statevector emulator based on PyTorch. The code is open source, hosted on Github and maintained by Pasqal.
Backend
dataclass
Bases: Backend
PyQTorch backend.
convert(circuit, observable=None)
Convert an abstract circuit (and optionally and observable) to their native representation. Additionally this function constructs an embedding function which maps from user-facing parameters to device parameters (read more on parameter embedding here).
Source code in qadence/backend.py
Configuration
dataclass
Bases: BackendConfiguration
interaction: Callable | Interaction | str = Interaction.NN
class-attribute
instance-attribute
Digital-analog emulation interaction that is used for AnalogBlock
s.
loop_expectation: bool = False
class-attribute
instance-attribute
When computing batches of expectation values, only allocate one wavefunction and loop over the batch of parameters to only allocate a single wavefunction at any given time.
use_gradient_checkpointing: bool = False
class-attribute
instance-attribute
Use gradient checkpointing. Recommended for higher-order optimization tasks.
use_single_qubit_composition: bool = False
class-attribute
instance-attribute
Composes chains of single qubit gates into a single matmul if possible.
supported_gates = list(set(OpName.list()) - set([OpName.TDAGGER]))
module-attribute
The set of supported gates. Tdagger is currently not supported.
PyQComposedBlock(ops, qubits, n_qubits, config=None)
Bases: Module
Compose a chain of single qubit operations on the same qubit into a single call to _apply_batch_gate.
Source code in qadence/backends/pyqtorch/convert_ops.py
ScalePyQOperation(n_qubits, block, config)
Bases: Module
Computes:
M = matrix(op, theta)
scale * matmul(M, state)