Transformation-based synthesis (TBS)¶
Header: tweedledum/algorithms/synthesis/tbs.hpp
Transformation-based synthesis algorithms modify the input permutation by adding gates to the input or output side of a circuit in a way that the permutation becomes the identity. The gates collected in this process construct a reversible circuit realizing the permutation.
Parameters¶
-
struct
tbs_params
¶ Parameters for
tbs
.Public Types
Public Members
-
cost_fn_type
cost_fn
= [](auto& permutation, auto x, auto z) { return __builtin_popcount(z ^ x) + __builtin_popcount(x ^ permutation[z]); }¶ Cost function in multi-directional synthesis.
By default the number of reversible gates is used as cost function.
-
bool
verbose
= false¶ Be verbose.
-
cost_fn_type
Algorithm¶
-
template<typename
Network
>
Networktweedledum
::
tbs
(std::vector<uint32_t> permutation, tbs_params params = {}) Transformation-based reversible logic synthesis.
This algorithm implements various variants of the transformation-based synthesis algorithm originally proposed in [MMD03]. A permutation is specified as a vector of \(2^n\) different integers ranging from \(0\) to \(2^n-1\).
std::vector<uint32_t> permutation{{0, 2, 3, 5, 7, 1, 4, 6}}; auto network = tbs<netlist<io3_gate>>(permutation);
- Parameters
permutation
: A vector of different integersparams
: Parameters (seetbs_params
)
-
template<typename
Network
>
voidtweedledum
::
tbs
(Network &network, std::vector<io_id> const &qubits, std::vector<uint32_t> permutation, tbs_params params = {}) Transformation-based reversible logic synthesis.
This is the in-place variant of
tbs
, in which the network is passed as a parameter and can potentially already contain some gates. The parameterqubits
provides a qubit mapping to the existing qubits in the network.- Parameters
network
: A quantum circuitqubits
: A qubit mappingpermutation
: A vector of different integersparams
: Parameters (seetbs_params
)