quimb.tensor.circuit.gates¶
Gate definitions, registries, and the Gate class for circuits.
Attributes¶
Classes¶
A simple class for storing the details of a quantum circuit gate. |
Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parametrized controlled X-rotation. |
|
Parametrized controlled Y-rotation. |
|
Parametrized controlled Z-rotation. |
|
|
|
|
|
|
|
|
|
|
|
|
|
Parametrized two qubit XX-rotation. |
|
Parametrized two qubit YY-rotation. |
|
Parametrized two qubit ZZ-rotation. |
|
See https://arxiv.org/abs/quant-ph/0308006 - Fig. 7. |
|
|
|
Build a low rank hyper tensor network (CP-decomp like) representation of |
|
Apply a multi-controlled gate to a state represented as an MPS. |
|
|
|
Apply a multi-controlled gate to a state whose gates are eagerly |
|
|
|
|
|
Sample a bitstring from n-dimensional tensor |
|
|
|
Map all types of gate specification into a Gate object. |
Module Contents¶
- quimb.tensor.circuit.gates.ALL_GATES¶
- quimb.tensor.circuit.gates.ONE_QUBIT_GATES¶
- quimb.tensor.circuit.gates.TWO_QUBIT_GATES¶
- quimb.tensor.circuit.gates.ALL_PARAM_GATES¶
- quimb.tensor.circuit.gates.ONE_QUBIT_PARAM_GATES¶
- quimb.tensor.circuit.gates.TWO_QUBIT_PARAM_GATES¶
- quimb.tensor.circuit.gates.GATE_TAGS¶
- quimb.tensor.circuit.gates.GATE_SIZE¶
- quimb.tensor.circuit.gates.CONSTANT_GATES¶
- quimb.tensor.circuit.gates.PARAM_GATES¶
- quimb.tensor.circuit.gates.SPECIAL_GATES¶
- quimb.tensor.circuit.gates.register_special_gate(name, fn, num_qubits, tag=None, array=None)[source]¶
- quimb.tensor.circuit.gates.rxx_param_gen(params)[source]¶
Parametrized two qubit XX-rotation.
\[\mathrm{RXX}(\theta) = \exp(-i \frac{\theta}{2} X_i X_j)\]
- quimb.tensor.circuit.gates.ryy_param_gen(params)[source]¶
Parametrized two qubit YY-rotation.
\[\mathrm{RYY}(\theta) = \exp(-i \frac{\theta}{2} Y_i Y_j)\]
- quimb.tensor.circuit.gates.rzz_param_gen(params)[source]¶
Parametrized two qubit ZZ-rotation.
\[\mathrm{RZZ}(\theta) = \exp(-i \frac{\theta}{2} Z_i Z_j)\]
- quimb.tensor.circuit.gates.su4_gate_param_gen(params)[source]¶
See https://arxiv.org/abs/quant-ph/0308006 - Fig. 7. params: # theta1, phi1, lamda1, # theta2, phi2, lamda2, # theta3, phi3, lamda3, # theta4, phi4, lamda4, # t1, t2, t3,
- quimb.tensor.circuit.gates._MPS_METHODS¶
- quimb.tensor.circuit.gates.build_controlled_gate_htn(ncontrol, gate, upper_inds, lower_inds, tags_each=None, tags_all=None, bond_ind=None)[source]¶
Build a low rank hyper tensor network (CP-decomp like) representation of a multi controlled gate.
- quimb.tensor.circuit.gates._apply_controlled_gate_mps(psi, gate, tags=None, **gate_opts)[source]¶
Apply a multi-controlled gate to a state represented as an MPS.
- quimb.tensor.circuit.gates._apply_controlled_gate_htn(psi, gate, tags=None, propagate_tags='register', **gate_opts)[source]¶
- quimb.tensor.circuit.gates._apply_controlled_gate_eager(psi, gate, tags=None, **gate_opts)[source]¶
Apply a multi-controlled gate to a state whose gates are eagerly contracted (e.g. a dense statevector): insert the low-rank HTN representation of the gate, then contract the resulting tensor network back into the dense state. This avoids ever forming the full
2**(2N)dense operator.
- quimb.tensor.circuit.gates.apply_controlled_gate(psi, gate, tags=None, contract='auto-split-gate', propagate_tags='register', **gate_opts)[source]¶
- class quimb.tensor.circuit.gates.Gate(label, params, qubits=None, controls=None, round=None, parametrize=False)[source]¶
A simple class for storing the details of a quantum circuit gate.
- Parameters:
label (str) – The name or ‘identifier’ of the gate.
params (Iterable[float]) – The parameters of the gate.
qubits (Iterable[int], optional) – Which qubits the gate acts on.
controls (Iterable[int], optional) – Which qubits are the controls.
round (int, optional) – If given, which round or layer the gate is part of.
parametrize (bool, optional) – Whether the gate will correspond to a parametrized tensor.
- __slots__ = ('_label', '_params', '_qubits', '_controls', '_round', '_parametrize', '_tag', '_special',...¶
- _label¶
- _params¶
- _round¶
- _parametrize = False¶
- _tag¶
- _special¶
- _constant¶
- _array = None¶
- property label¶
- property params¶
- property qubits¶
- property total_qubit_count¶
- property controls¶
- property round¶
- property special¶
- property parametrize¶
- property tag¶
- build_array()[source]¶
Build the array representation of the gate. For controlled gates this excludes the control qubits.
- property array¶