tequila.hamiltonian.paulis.KetBra¶
-
tequila.hamiltonian.paulis.
KetBra
(ket: tequila.wavefunction.qubit_wavefunction.QubitWaveFunction, bra: tequila.wavefunction.qubit_wavefunction.QubitWaveFunction, hermitian: bool = False, threshold: float = 1e-06, n_qubits=None)[source]¶ Initialize the general KetBra operator
Notes
Initialize the general KetBra operator
\[H = \lvert ket \rangle \langle bra \rvert\]e.g.
>>> wfn1 = tq.QubitWaveFunction.from_string("1.0*|00> + 1.0*|11>").normalize() >>> wfn2 = tq.QubitWaveFunction.from_string("1.0*|00>") >>> operator = tq.paulis.KetBra(ket=wfn1, bra=wfn1)
initializes the transfer operator from the all-zero state to a Bell state
- Parameters
ket (QubitWaveFunction) – QubitWaveFunction which defines the ket element can also be given as string or array or integer
bra (QubitWaveFunction) – QubitWaveFunction which defines the bra element can also be given as string or array or integer
hermitian (bool (Default False)) – if True the hermitian version H + H^dagger is returned
threshold (float (Default 1.e-6)) – elements smaller than the threshold will be ignored
n_qubits (only needed if ket and/or bra are passed down as integers) –
- Returns
a tequila QubitHamiltonian (not necessarily hermitian) representing the KetBra operator desired.
- Return type
QubitHamiltonian