qrunch.quantum.algorithms.pauli.vqes.gate_pool
Module containing everything needed to create gate pools used in adaptive VQEs.
Classes
Class to build and generate a custom gate pool. |
|
Custom gate pool operator used in a gate pool. |
|
Double excitation gate used in a gate pool. |
|
Represents a double excitation operator and hold the indices of the operation. |
|
Class to build and generate a gate pool. |
|
Interface for a gate pool operator. |
|
Single excitation gate used in a gate pool. |
|
Represents a single excitation operator and hold the indices of the operation. |
- class CustomGatePool
Bases:
objectClass to build and generate a custom gate pool.
- __init__(gate_pool_operators: Sequence[GatePoolOperator]) None
Initiate custom gate pool with the given operators.
- Parameters:
gate_pool_operators (Sequence[GatePoolOperator]) – List of gate pool operators in the custom gate pool.
- Return type:
None
- class CustomGatePoolOperator
Bases:
GatePoolOperatorCustom gate pool operator used in a gate pool.
- __init__(gate: Gate, generator: AntiHermitianPauliSum | Expression[PauliOperators]) None
Initiate a custom gate pool operator with the given gate and generator.
The gate implementing an operator \(\hat{G}\) is related to the generator \(\hat{A}\) through:
\[\hat{G}(\phi) = e^{\phi \hat{A}}.\]NB. It is not validated that the gate and generator fulfills this relation.
- Parameters:
gate (Gate) – Gate for the gate pool operator.
generator (AntiHermitianPauliSum | Expression[PauliOperators]) – generator for the gate pool operator.
- Raises:
GatePoolError – If the gate does not contain exactly one free parameter.
- Return type:
None
- get_generator() SingleExcitationOperator | DoubleExcitationOperator | AntiHermitianPauliSum
Get generator for the gate pool operator.
- Parameters:
parameter – Parameter to be used in gate.
- Return type:
SingleExcitationOperator | DoubleExcitationOperator | AntiHermitianPauliSum
- class DoubleExcitationGatePoolOperator
Bases:
GatePoolOperatorDouble excitation gate used in a gate pool.
The gate is a
qrunch.core.circuit.composite_gates.DoubleExcitationGateand the generator is a \(A = Q_p^\dagger Q_q^\dagger Q_r Q_s - Q_r^\dagger Q_s^\dagger Q_p Q_q\), where \(Q_i\) and \(Q_i^\dagger\) removes and adds one qubit excitation for the \(i\)’th site, respectively.- __init__(creation_qubit_index_1: int, creation_qubit_index_2: int, annihilation_qubit_index_1: int, annihilation_qubit_index_2: int) None
Initiate an instance of the double excitation gate pool gate.
- Parameters:
creation_qubit_index_1 (int) – First qubit index for the gate.
creation_qubit_index_2 (int) – Second qubit index for the gate.
annihilation_qubit_index_1 (int) – Third qubit index for the gate.
annihilation_qubit_index_2 (int) – Four qubit index for the gate.
- Return type:
None
- get_gate(parameter: Parameter) DoubleExcitationGate
Get gate for the gate pool operator.
- Parameters:
parameter (Parameter) – Parameter to be used in gate.
- Return type:
- get_generator() DoubleExcitationOperator
Get generator for the gate pool operator.
- Parameters:
parameter – Parameter to be used in gate.
- Return type:
- class DoubleExcitationOperator
Bases:
objectRepresents a double excitation operator and hold the indices of the operation.
This operator is the generator of the
DoubleExcitationGate. All fields are immutable (frozen=True) so an instance can be safely reused.- Parameters:
creation_qubit_index_1 – The index of the first qubit where the excitation is created.
creation_qubit_index_2 – The index of the second qubit where the excitation is created.
annihilation_qubit_index_1 – The index of the first qubit where the excitation is annihilated.
annihilation_qubit_index_2 – The index of the second qubit where the excitation is annihilated.
- __init__(creation_qubit_index_1: int, creation_qubit_index_2: int, annihilation_qubit_index_1: int, annihilation_qubit_index_2: int) None
- Parameters:
creation_qubit_index_1 (int)
creation_qubit_index_2 (int)
annihilation_qubit_index_1 (int)
annihilation_qubit_index_2 (int)
- Return type:
None
- annihilation_qubit_index_1: int
- annihilation_qubit_index_2: int
- creation_qubit_index_1: int
- creation_qubit_index_2: int
- indices() tuple[int, ...]
Get indices of the operator.
- Return type:
tuple[int, …]
- class GatePoolOperator
Bases:
ProtocolInterface for a gate pool operator.
A gate pool operator contains a gate which can be added to a circuit and a generator for the gate which can be used for judging the usefulness of a given gate pool operator. The gate pool gate implementing an operator \(\hat{G}\) is related to the generator \(\hat{A}\) through:
\[\hat{G}(\phi) = e^{\phi \hat{A}}\]- __init__(*args, **kwargs)
- get_generator() SingleExcitationOperator | DoubleExcitationOperator | AntiHermitianPauliSum
Get generator for the gate pool operator.
- Return type:
SingleExcitationOperator | DoubleExcitationOperator | AntiHermitianPauliSum
- class SingleExcitationGatePoolOperator
Bases:
GatePoolOperatorSingle excitation gate used in a gate pool.
The gate is a
qrunch.core.circuit.composite_gates.SingleExcitationGateand the generator is a \(A = Q_p^\dagger Q_q - Q_q^\dagger Q_p\), where \(Q_i\) and \(Q_i^\dagger\) removes and adds one qubit excitation for the \(i\)’th site, respectively.- __init__(creation_qubit_index: int, annihilation_qubit_index: int) None
Initiate an instance of the single excitation gate pool gate.
- Parameters:
creation_qubit_index (int) – First qubit index for the gate.
annihilation_qubit_index (int) – Second qubit index for the gate.
- Return type:
None
- get_gate(parameter: Parameter) SingleExcitationGate
Get gate for the gate pool operator.
- Parameters:
parameter (Parameter) – Parameter to be used in gate.
- Return type:
- get_generator() SingleExcitationOperator
Get generator for the gate pool operator.
- Parameters:
parameter – Parameter to be used in gate.
- Return type:
- class SingleExcitationOperator
Bases:
objectRepresents a single excitation operator and hold the indices of the operation.
This operator is the generator of the
SingleExcitationGate. All fields are immutable (frozen=True) so an instance can be safely reused.- Parameters:
creation_qubit_index – The index of the qubit where the excitation is created.
annihilation_qubit_index – The index of the qubit where the excitation is annihilated.
- __init__(creation_qubit_index: int, annihilation_qubit_index: int) None
- Parameters:
creation_qubit_index (int)
annihilation_qubit_index (int)
- Return type:
None
- annihilation_qubit_index: int
- creation_qubit_index: int
- indices() tuple[int, ...]
Get indices of the operator.
- Return type:
tuple[int, …]