Synthesis of diagonal unitaries¶
Header: tweedledum/algorithms/synthesis/diagonal_synth.hpp
Algorithm¶
-
template<class
Circuit>
Circuittweedledum::diagonal_synth(std::vector<double> const &angles) Synthesis of diagonal unitary matrices.
This algorithm is based on the work in [SS03]. It takes as input \(2^n - 1\) real angles \(\theta_i\) for \(i = 1, \dots, 2^{n-1}\) and returns a quantum circuit that realizes the \(2^n \times 2^n\) unitary operation
\(U = \mathrm{diag}(1, e^{-\mathrm{i}\theta_1}, e^{-\mathrm{i}\theta_2}, \dots, e^{-\mathrm{i}\theta_{2^{n-1}}}).\)
It uses a fast Hadamard transformation to compute angles for parity terms that are passed to the Gray synthesis algorithm
gray_synth.- Return
{CNOT, Rz} network
- Parameters
angles: Angles for diagonal matrix elements
-
template<class
Circuit>
voidtweedledum::diagonal_synth(Circuit &circ, std::vector<io_id> const &qubits, std::vector<double> const &angles) Gray synthesis for {CNOT, Rz} networks.
This is the in-place variant of
diagonal_synth, in which the network is passed as a parameter and can potentially already contain some gates. The parameterqubitsprovides a qubit mapping to the existing qubits in the network.- Parameters
circ: A quantum networkqubits: The subset of qubits the linear reversible circuit acts uponangles: Angles for diagonal matrix elements