tket
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Friends | List of all members
tket::Transform Class Reference

A transformation of a circuit that preserves its semantics. More...

#include <Transform.hpp>

Public Types

typedef std::function< bool(Circuit &, std::shared_ptr< unit_bimaps_t >)> Transformation
 A function that takes a circuit and (optionally) a relabelling of units.
 
typedef std::function< bool(Circuit &)> SimpleTransformation
 A function that takes a circuit and does not rename any units.
 
typedef std::function< unsigned(const Circuit &)> Metric
 

Public Member Functions

 Transform (const Transformation &trans)
 Construct from a transformation function.
 
 Transform (const SimpleTransformation &trans)
 Construct from a transformation function that preserves unit IDs.
 
bool apply (Circuit &circ) const
 Apply the transform to a circuit.
 

Public Attributes

Transformation apply_fn
 The transformation applied.
 

Friends

Transform operator>> (const Transform &lhs, const Transform &rhs)
 Compose two transforms in sequence.
 

Detailed Description

A transformation of a circuit that preserves its semantics.

Definition at line 27 of file Transform.hpp.

Member Typedef Documentation

◆ Metric

typedef std::function<unsigned(const Circuit&)> tket::Transform::Metric

Definition at line 48 of file Transform.hpp.

◆ SimpleTransformation

typedef std::function<bool(Circuit&)> tket::Transform::SimpleTransformation

A function that takes a circuit and does not rename any units.

The function returns false if no changes are made, otherwise true.

Definition at line 46 of file Transform.hpp.

◆ Transformation

typedef std::function<bool(Circuit&, std::shared_ptr<unit_bimaps_t>)> tket::Transform::Transformation

A function that takes a circuit and (optionally) a relabelling of units.

The relabelling, if present, maps the original unit IDs at the beginning and end of the circuit to new names, which may be in a different order at the beginning and end.

The function returns false if no changes are made, otherwise true.

Definition at line 39 of file Transform.hpp.

Constructor & Destructor Documentation

◆ Transform() [1/2]

tket::Transform::Transform ( const Transformation trans)
inlineexplicit

Construct from a transformation function.

Definition at line 54 of file Transform.hpp.

◆ Transform() [2/2]

tket::Transform::Transform ( const SimpleTransformation trans)
inlineexplicit

Construct from a transformation function that preserves unit IDs.

Definition at line 57 of file Transform.hpp.

Member Function Documentation

◆ apply()

bool tket::Transform::apply ( Circuit circ) const
inline

Apply the transform to a circuit.

Parameters
circcircuit to be transformed
Returns
whether any changes were made

Definition at line 69 of file Transform.hpp.

Friends And Related Symbol Documentation

◆ operator>>

Transform operator>> ( const Transform lhs,
const Transform rhs 
)
friend

Compose two transforms in sequence.

Parameters
[in]lhsfirst transform
[in]rhssecond transform
Returns
the composite transform

Definition at line 23 of file Combinator.cpp.

Member Data Documentation

◆ apply_fn

Transformation tket::Transform::apply_fn

The transformation applied.

Definition at line 51 of file Transform.hpp.


The documentation for this class was generated from the following file: