tket
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tket::zx::ZXGen Class Referenceabstract

Abstract class for a ZX generator. More...

#include <ZXGenerator.hpp>

Inheritance diagram for tket::zx::ZXGen:
Inheritance graph
[legend]

Public Member Functions

ZXType get_type () const
 
virtual std::optional< QuantumTypeget_qtype () const =0
 Return the quantum type of the generator, if it is definable.
 
virtual bool valid_edge (std::optional< unsigned > port, QuantumType qtype) const =0
 Returns whether or not an edge of a given QuantumType can validly be placed on the given port.
 
virtual SymSet free_symbols () const =0
 
virtual ZXGen_ptr symbol_substitution (const SymEngine::map_basic_basic &sub_map) const =0
 Operation with values substituted for symbols.
 
virtual std::string get_name (bool latex=false) const =0
 Outputs a string-based description for the generator.
 
virtual bool is_equal (const ZXGen &other) const
 Implementation of equivalence checking to eliminate ambiguous warnings for operator==.
 
bool operator== (const ZXGen &other) const
 
virtual ~ZXGen ()
 

Static Public Member Functions

static ZXGen_ptr create_gen (ZXType type, QuantumType qtype=QuantumType::Quantum)
 Generic constructors for obtaining generators with more generality than going via subtype constructors.
 
static ZXGen_ptr create_gen (ZXType type, const Expr &param, QuantumType qtype=QuantumType::Quantum)
 
static ZXGen_ptr create_gen (ZXType type, bool param, QuantumType qtype=QuantumType::Quantum)
 

Protected Member Functions

 ZXGen (ZXType type)
 ZXGen (Base class) implementation.
 

Protected Attributes

const ZXType type_
 

Detailed Description

Abstract class for a ZX generator.

Each ZXType has a single possible subclass that can realise it, allowing us to statically cast to a subclass once that is determined. Treatment of ports and QuantumType is handled by each subclass.

Definition at line 122 of file ZXGenerator.hpp.

Constructor & Destructor Documentation

◆ ~ZXGen()

tket::zx::ZXGen::~ZXGen ( )
virtual

Definition at line 89 of file ZXGenerator.cpp.

◆ ZXGen()

tket::zx::ZXGen::ZXGen ( ZXType  type)
protected

ZXGen (Base class) implementation.

Definition at line 79 of file ZXGenerator.cpp.

Member Function Documentation

◆ create_gen() [1/3]

ZXGen_ptr tket::zx::ZXGen::create_gen ( ZXType  type,
bool  param,
QuantumType  qtype = QuantumType::Quantum 
)
static

Definition at line 148 of file ZXGenerator.cpp.

◆ create_gen() [2/3]

ZXGen_ptr tket::zx::ZXGen::create_gen ( ZXType  type,
const Expr param,
QuantumType  qtype = QuantumType::Quantum 
)
static

Definition at line 128 of file ZXGenerator.cpp.

◆ create_gen() [3/3]

ZXGen_ptr tket::zx::ZXGen::create_gen ( ZXType  type,
QuantumType  qtype = QuantumType::Quantum 
)
static

Generic constructors for obtaining generators with more generality than going via subtype constructors.

Definition at line 91 of file ZXGenerator.cpp.

◆ free_symbols()

virtual SymSet tket::zx::ZXGen::free_symbols ( ) const
pure virtual

◆ get_name()

virtual std::string tket::zx::ZXGen::get_name ( bool  latex = false) const
pure virtual

Outputs a string-based description for the generator.

This should be enough to specify the generator exactly.

Parameters
latexwhether the string should be formatted for LaTeX math mode or plaintext

Implemented in tket::zx::BoundaryGen, tket::zx::PhasedGen, tket::zx::CliffordGen, tket::zx::DirectedGen, and tket::zx::ZXBox.

◆ get_qtype()

virtual std::optional< QuantumType > tket::zx::ZXGen::get_qtype ( ) const
pure virtual

Return the quantum type of the generator, if it is definable.

It may not be definable for directed generators that mix types of different ports, such as ZXBox.

What this means might be context dependent. Generally, we say that this is the expected quantum type of every incident edge. However, Classical BasicGen objects (spiders, HBox) can accept Quantum edges which are treated as a pair of edges.

Implemented in tket::zx::BoundaryGen, tket::zx::BasicGen, tket::zx::DirectedGen, and tket::zx::ZXBox.

◆ get_type()

ZXType tket::zx::ZXGen::get_type ( ) const

Definition at line 81 of file ZXGenerator.cpp.

◆ is_equal()

bool tket::zx::ZXGen::is_equal ( const ZXGen other) const
virtual

Implementation of equivalence checking to eliminate ambiguous warnings for operator==.

Assumes other matches the ZXType of this, so it is safe to cast.

Reimplemented in tket::zx::BoundaryGen, tket::zx::BasicGen, tket::zx::PhasedGen, tket::zx::CliffordGen, tket::zx::DirectedGen, and tket::zx::ZXBox.

Definition at line 87 of file ZXGenerator.cpp.

◆ operator==()

bool tket::zx::ZXGen::operator== ( const ZXGen other) const

Definition at line 83 of file ZXGenerator.cpp.

◆ symbol_substitution()

virtual ZXGen_ptr tket::zx::ZXGen::symbol_substitution ( const SymEngine::map_basic_basic &  sub_map) const
pure virtual

Operation with values substituted for symbols.

Parameters
sub_mapmap from symbols to values
Returns
New operation with symbols substituted, or a null pointer if it is unchanged

Implemented in tket::zx::BoundaryGen, tket::zx::PhasedGen, tket::zx::CliffordGen, tket::zx::DirectedGen, and tket::zx::ZXBox.

◆ valid_edge()

virtual bool tket::zx::ZXGen::valid_edge ( std::optional< unsigned >  port,
QuantumType  qtype 
) const
pure virtual

Returns whether or not an edge of a given QuantumType can validly be placed on the given port.

Implemented in tket::zx::BoundaryGen, tket::zx::BasicGen, tket::zx::DirectedGen, and tket::zx::ZXBox.

Member Data Documentation

◆ type_

const ZXType tket::zx::ZXGen::type_
protected

Definition at line 193 of file ZXGenerator.hpp.


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