Data Structures¶
Abstract network¶
-
struct
abstract_storage_node: public mockturtle::mixed_fanin_node<2>¶ data[0].h1: Fan-out sizedata[0].h2: Application-specific value (weight)data[1].h1: Function literal in truth table cachedata[2].h2: Visited flags
-
class
caterpillar::abstract_network¶ General network in which each node is characterized by its input signals and an application-specific value.
Public Types
-
using
base_type= abstract_network¶
-
using
storage= std::shared_ptr<abstract_storage>¶
-
using
node= uint64_t¶
-
using
signal= uint64_t¶
Public Functions
-
abstract_network()¶
-
signal
create_node(std::vector<signal> const &children, uint32_t weight = 1)¶ creates an abstract node and returns its outcoming signal
-
auto
size() const¶ returns the number of nodes in the network
-
auto
num_pis() const¶ returns the number of primary inputs
-
auto
num_pos() const¶ returns the number of primary outputs
-
auto
num_gates() const¶ returns the number of actual gates (not considering primary inputs and constant nodes)
-
template<typename
Fn>
voidforeach_node(Fn &&fn) const¶ executes a function for every node of the nework
-
template<typename
Fn>
voidforeach_pi(Fn &&fn) const¶ executes a function for every primary input of the nework
-
template<typename
Fn>
voidforeach_po(Fn &&fn) const¶ executes a function for every primary output of the nework
-
template<typename
Fn>
voidforeach_gate(Fn &&fn) const¶ executes a function for every gate of the nework
-
template<typename
Fn>
voidforeach_fanin(node const &n, Fn &&fn) const¶ executes a function for every incoming signal of a node
-
void
clear_weights() const¶ clears the application specific value for every node
-
void
clear_visited() const¶
Public Members
-
std::shared_ptr<abstract_storage>
_storage¶
-
using
Single-target gate¶
-
class
caterpillar::stg_gate: public gate_base¶ A single-target gate is a reversible gate characterized by:
_functiona control function,_controlsa list of control qubits,_targetsa list of target qubits.X gates are applied to the targets whenever the control function evaluates to true.
Public Functions
-
stg_gate(gate_base const &op, td::qubit_id target)¶
-
stg_gate(gate_base const &op, td::qubit_id control, td::qubit_id target)¶
-
stg_gate(gate_base const &op, std::vector<td::qubit_id> const &controls, std::vector<td::qubit_id> const &targets)¶
-
stg_gate(kitty::dynamic_truth_table const &function, std::vector<td::qubit_id> const &controls, td::qubit_id target)¶
-
bool
is_unitary_gate() const¶
-
uint32_t
num_controls() const¶
-
uint32_t
num_targets() const¶
-
auto
controls() const¶
-
auto
targets() const¶
-