Real Basis Rotation Ansatzes¶
An orbital basis transformation can be represented on a quantum circuit with Givens rotation gates [42]. This circuit representation allows us to define the set of classes:
These classes apply a unitary transformation to a reference state, in the form:
where the relationship between a real basis transformation matrix \(\textbf{R}\) and the variational parameters is \(\theta_{ij} = [\ln \textbf{R}]_{ij}\), according to the Thouless theorem [41]. This ansatz can be used in variatonal algorithms to find for example the mean-field solution of a chemistry Hamiltonian on quantum computer:
from pytket.extensions.qiskit import AerStateBackend
from inquanto.ansatzes import RealGeneralizedBasisRotationAnsatz
from inquanto.express import load_h5, run_vqe
from inquanto.states import QubitState
reference = QubitState([1, 1, 0, 0])
ra = RealGeneralizedBasisRotationAnsatz(reference=reference)
h2_sto3g = load_h5("h2_sto3g.h5", as_tuple=True)
hamiltonian_lowdin = h2_sto3g.hamiltonian_operator_lowdin.qubit_encode()
print("HF energy (ref): ", h2_sto3g.energy_hf)
print("<REF|H|REF>: ", reference.vdot(hamiltonian_lowdin.dot_state(reference)))
vqe = run_vqe(ra, hamiltonian_lowdin, AerStateBackend(), initial_parameters=ra.state_symbols.construct_random() )
print("VQE energy: ", vqe.final_value)
HF energy (ref): -1.1175058842043306
<REF|H|REF>: -0.12440620192256865
# TIMER BLOCK-0 BEGINS AT 2024-11-20 16:01:07.077337
# TIMER BLOCK-0 ENDS - DURATION (s): 5.3926370 [0:00:05.392637]
VQE energy: -1.1175058841959695
Given a real unitary matrix \(\textbf{R}\), we can also compute the corresponding ansatz parameters:
import numpy
# unitary matrix for which the QR gives R with diagonals [1,1,1,-1]
R = numpy.array(
[
[0.04443313, -0.95103332, 0.1990091, -0.2322858],
[-0.14642999, -0.16713913, -0.96063852, -0.16672251],
[0.98783978, 0.02520736, -0.14785981, -0.04092234],
[-0.02750505, 0.25877542, 0.1253255, -0.95737781],
]
)
p = ra.ansatz_parameters_from_unitary(R)
print(f"Rotation parameters:\n{p}")
Rotation parameters:
{phi_0: np.float64(0.0), phi_1: np.float64(0.0), phi_2: np.float64(0.0), phi_3: np.float64(3.141592653589793), theta_1_0: np.float64(-1.526348563129208), theta_2_0: np.float64(-1.7179010586215773), theta_2_1: np.float64(-0.3111780679781251), theta_3_0: np.float64(0.027836442642734202), theta_3_1: np.float64(-1.0105744336026967), theta_3_2: np.float64(0.8624009177850533)}
The RealGeneralizedBasisRotationAnsatz
supports generalized real rotations, which may
couple spin channels. For restricted rotations i.e. both \(\alpha\) and \(\beta\) spins are rotated by the same
matrix independently of one another, one should use the RealRestrictedBasisRotationAnsatz
.
For unrestricted rotations, where \(\alpha\) and \(\beta\) spins are rotated by different
matrices, one should use the RealUnrestrictedBasisRotationAnsatz
.