tket
|
Defines tket::DeviceCharacterisation, used in NoiseAwarePlacement and in commute_SQ_gates_through_SWAPS as a simple device noise model. More...
Namespaces | |
namespace | aas |
namespace | CircPool |
namespace | graphs |
Computation of Articulation Points (APs) on undirected graphs. | |
namespace | internal |
namespace | test_Ops |
namespace | tket_sim |
namespace | Transforms |
namespace | WeightedSubgraphMonomorphism |
namespace | zx |
Classes | |
class | AASLabellingMethod |
class | AASRouteError |
class | AASRouteRoutingMethod |
class | AbstractSquasher |
Abstract Squasher interface. More... | |
class | Architecture |
class | ArchitectureBase |
Generic architecture class. More... | |
class | ArchitectureInvalidity |
class | ArchitectureMapping |
Intended for use with TokenSwapping. More... | |
class | BadCommand |
class | BadOpType |
Operation type not valid in the current context. More... | |
class | BarrierOp |
class | BasePass |
struct | BestTsaWithArch |
A simple wrapper around BestFullTsa from TokenSwapping, using Architecture objects directly to find distances and neighbours. More... | |
class | Bit |
Location holding a bit. More... | |
struct | BoolPauli |
Boolean encoding of Pauli <x, z> = <false, false> ==> I <x, z> = <false, true> ==> Z <x, z> = <true, false> ==> X <x, z> = <true, true> ==> Y. More... | |
struct | BoundaryElement |
class | Box |
Abstract class for an operation from which a circuit can be extracted. More... | |
class | BoxDecomposition |
class | BoxDecompositionRoutingMethod |
class | ChoiMixTableau |
class | CircBox |
Operation defined as a circuit. More... | |
class | CircToPhasePolyConversion |
this class realises the conversion all sub circuits of a given circuits which contains only CX+Rz to a PhasePolyBox. More... | |
class | Circuit |
A circuit. More... | |
class | CircuitInequality |
class | CircuitInvalidity |
class | ClassicalEvalOp |
class | ClassicalOp |
A purely classical operation. More... | |
class | ClassicalTransformOp |
A general classical operation where all inputs are also outputs. More... | |
class | ClExpr |
A classical expression. More... | |
class | ClExprOp |
class | ClExprWiringError |
class | CliffordCircuitPredicate |
class | CliffordReductionPass |
class | CliffordReductionPassTester |
a simple friend class of CliffordReductionPass used for testing private member functions More... | |
struct | ClRegVar |
A register variable within an expression. More... | |
class | Command |
class | CommutableMeasuresPredicate |
Asserts that any internal measurements can be commuted to the end of the circuit. More... | |
class | CompilationUnit |
class | CompositeGateDef |
class | Conditional |
Decorates another op, adding a QASM-style classical condition. More... | |
class | ConjugationBox |
Box to express computations that follow the compute-action-uncompute pattern. More... | |
class | ConnectivityPredicate |
class | CopyBitsOp |
An operation to copy some bit values. More... | |
class | CustomGate |
struct | CutFrontier |
class | CXMaker |
class | Cycle |
struct | CycleCom |
class | CycleFinder |
struct | CycleHistory |
class | DefaultRegisterPredicate |
struct | DependencyEdgeProperties |
class | DeviceCharacterisation |
class | DiagMatrix |
class | DiagonalBox |
Box to synthesise a diagonal operator. More... | |
class | DirectednessPredicate |
class | DistancesFromArchitecture |
Directly get distances from an architecture object, but evaluated lazily. More... | |
class | DummyBox |
A placeholder operation that holds resource data. More... | |
class | DummyBoxNotDecomposable |
Exception indicating that dummy boxes cannot be decomposed. More... | |
struct | EdgeProperties |
Description of an edge in a circuit, representing a directional wire. More... | |
class | ExpBox |
Two-qubit operation defined in terms of a hermitian matrix and a phase. More... | |
class | ExplicitModifierOp |
A modifying operation defined explicitly by a truth table. More... | |
class | ExplicitPredicateOp |
A predicate defined explicitly by a truth table. More... | |
class | FlowOp |
class | FrameRandomisation |
class | FrameRandomisationTester |
class | FullyConnected |
class | Gate |
class | GateSetPredicate |
Asserts that all operations are in the specified set of types. More... | |
struct | GateSpec |
struct | GateUnitaryMatrix |
Functions to return the unitary matrix which a gate represents. More... | |
struct | GateUnitaryMatrixError |
We do not wish to couple tightly to exception classes elsewhere. More... | |
class | GraphPlacement |
class | IncompatibleCompilerPasses |
class | IncorrectPredicate |
struct | InteractionMatch |
Represents a position to which two 2q Clifford gadgets could be commuted to Assumes: More... | |
struct | InteractionPoint |
Represents a position that one port of a 2qb Clifford gadget could be commuted to (towards the end of the circuit). More... | |
class | InvalidParameterCount |
Wrong number of parameters for an operation. More... | |
class | InvalidUnitConversion |
Conversion invalid. More... | |
class | JsonError |
class | LexicographicalComparison |
A class for running lexicographical comparisons of SWAP gates for some architecture and set of interacting qubits. More... | |
class | LexicographicalComparisonError |
class | LexiLabellingMethod |
class | LexiRoute |
A class for modifiying a Circuit held in a MappingFrontier object with either an Architecture permitted single SWAP gate or BRIDGE gate. More... | |
class | LexiRouteError |
class | LexiRouteRoutingMethod |
class | LinePlacement |
struct | MappingFrontier |
class | MappingFrontierError |
class | MappingManager |
class | MappingManagerError |
class | MaxNClRegPredicate |
Asserts that the circuit only contains N classical registers or less. More... | |
class | MaxNQubitsPredicate |
class | MaxTwoQubitGatesPredicate |
class | MeasurementSetup |
MeasurementSetup Captures an expectation value experiment. More... | |
class | MetaOp |
class | MidCircuitMeasurementNotAllowed |
class | MissingEdge |
class | MissingVertex |
class | ModifyingOp |
A classical operation with one output bit which is also an input bit. More... | |
class | MultiBitOp |
A classical operation applied simultaneously to multiple bits. More... | |
class | MultiGateReorder |
class | MultiGateReorderRoutingMethod |
class | MultiplexedRotationBox |
Multiplexed single-axis rotations. More... | |
class | MultiplexedTensoredU2Box |
Multiplexed-Tensored-U2 gate. More... | |
class | MultiplexedU2Box |
Multiplexed U2 gate. More... | |
struct | MultiplexedU2Commands |
class | MultiplexorBox |
Multiplexed ops. More... | |
class | NeighbourPlacements |
Given a placement map generates n nearby placement maps. More... | |
class | NeighboursFromArchitecture |
Stores and returns upon request the adjacent vertices to a given vertex on a graph, using an underlying Architecture object. More... | |
struct | no_coeff_t |
A trivial option for PauliTensor to represent Pauli strings up to global scalar. More... | |
class | NoBarriersPredicate |
Asserts that the circuit contains no OpType::Barrier. More... | |
class | NoClassicalBitsPredicate |
class | NoClassicalControlPredicate |
Asserts that there are no conditional gates in the circuit. More... | |
class | Node |
Architectural qubit location. More... | |
class | NoFastFeedforwardPredicate |
class | NoiseAwarePlacement |
class | NoMidMeasurePredicate |
Asserts that any measurements occur at the end of the circuit. More... | |
class | NormalisedTK2Predicate |
Asserts that all TK2 gates are normalised. More... | |
class | NoSymbolsPredicate |
Asserts that no gates in the circuit have symbolic parameters. More... | |
class | NoWireSwapsPredicate |
class | Op |
Abstract class representing an operation type. More... | |
class | OpDesc |
Operation descriptor. More... | |
class | OpJsonFactory |
struct | OpTypeInfo |
General information about an OpType . More... | |
class | PassNotSerializable |
class | PauliExpBox |
Operation defined as the exponential of a tensor of Pauli operators. More... | |
class | PauliExpBoxInvalidity |
class | PauliExpCommutingSetBox |
class | PauliExpPairBox |
class | PauliFrameRandomisation |
struct | PauliGadgetProperties |
class | PauliGraph |
Dependency graph of a circuit wrt Pauli Gadgets. More... | |
class | PauliPartitionerGraph |
A helper class for converting QubitOperator into PauliACGraphs and then colouring the PauliACGraph using some method. More... | |
class | PauliTensor |
PauliTensor<PauliContainer, CoeffType> More... | |
class | PhasePolyBox |
A PhasePolyBox is capable of representing arbitrary Circuits made up of CNOT and RZ, as a PhasePolynomial plus a boolean matrix representing an additional linear transformation. More... | |
class | Placement |
class | PlacementPredicate |
struct | PostConditions |
class | PowerCycle |
class | Predicate |
class | PredicateNotSerializable |
class | PredicateOp |
A classical operation with single output bit. More... | |
class | ProjectorAssertionBox |
class | QControlBox |
Wraps another quantum op, adding control qubits. More... | |
class | Qubit |
Location holding a qubit. More... | |
class | QubitGraph |
Instance of DirectedGraph to hold dependencies between Qubit UnitID objects as given from some Circuit. More... | |
class | RangePredicateOp |
A predicate defined by a range of values in binary encoding. More... | |
class | RepeatPass |
class | RepeatUntilSatisfiedPass |
class | RepeatWithMetricPass |
struct | ResourceBounds |
struct | ResourceData |
struct | RevInteractionPoint |
Represents a position that one port of a 2qb Clifford gadget could be commuted to (towards the start of the circuit). More... | |
class | RingArch |
class | Rotation |
A faithful representation of SU(2). More... | |
class | RoutingMethod |
class | RoutingMethodCircuit |
class | SequencePass |
class | SetBitsOp |
An operation to set some bits to specified values. More... | |
class | SimpleOnly |
class | SingleQubitSquash |
Squashes single qubit gates using given Squasher. More... | |
class | SliceIterator |
class | SquareGrid |
class | StabiliserAssertionBox |
class | StandardPass |
class | StatePreparationBox |
Box to synthesise a statevector. More... | |
struct | Subcircuit |
Structure to describe a convex region of the interaction graph. More... | |
struct | SubgraphMonomorphisms |
A simple wrapper around the Weighted Subgraph Monomorphism code. More... | |
class | SubstitutionFailure |
class | SymbolsNotSupported |
Exception indicating that symbolic values are not supported. More... | |
struct | SymCompareLess |
class | SymplecticTableau |
struct | SymTable |
Utility class for accessing the global symbol table. More... | |
struct | TagEdge |
struct | TagID |
struct | TagIn |
struct | TagKey |
struct | TagOut |
struct | TagReg |
struct | TagSeq |
struct | TagSource |
struct | TagType |
struct | TagValue |
class | TermSequenceBox |
class | ToffoliBox |
Box to synthesise a state permutation. More... | |
class | Transform |
A transformation of a circuit that preserves its semantics. More... | |
struct | TraversalPoint |
struct | unit_bimaps_t |
A pair of ("initial" and "final") correspondences between unit IDs. More... | |
class | Unitary1qBox |
One-qubit operation defined as a unitary matrix. More... | |
class | Unitary2qBox |
Two-qubit operation defined as a unitary matrix (ILO-BE) More... | |
class | Unitary3qBox |
Three-qubit operation defined as a unitary matrix (ILO-BE) More... | |
class | UnitaryRevTableau |
class | UnitaryTableau |
class | UnitaryTableauBox |
Encapsulation of a unitary stabilizer tableau as a Box to use within a circuit. More... | |
class | UnitID |
Location holding a bit or qubit of information. More... | |
class | UniversalFrameRandomisation |
class | UnknownPauliPartitionStrat |
class | UnsatisfiedPredicate |
class | Unsupported |
class | UserDefinedPredicate |
struct | VertexProperties |
Description of a node in a circuit, representing some operation. More... | |
class | WasmNode |
WASM UID. More... | |
class | WASMOp |
Op containing a classical wasm function call. More... | |
class | WasmState |
Location holding a wasm UID. More... | |
class | WiredClExpr |
A classical expression defined over a sequence of bits. More... | |
Concepts | |
concept | arithmetic |
Typedefs | |
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS > | cube_graph_t |
typedef boost::graph_traits< cube_graph_t >::vertex_descriptor | perm_vert_t |
typedef std::vector< std::vector< bool > > | cycle_permutation_t |
typedef std::vector< transposition_t > | cycle_transposition_t |
typedef std::vector< std::pair< std::vector< bool >, unsigned > > | gray_code_t |
typedef std::pair< VertPort, ZXPortType > | TypedVertPort |
typedef std::pair< ZXVert, std::optional< unsigned > > | ZXVertPort |
typedef std::vector< ZXVertPort > | ZXVertPortVec |
typedef boost::bimap< ZXVert, Vertex > | BoundaryVertMap |
using | RelabelledPatternGraph = RelabelledGraphWSM< Qubit, QubitGraph::UndirectedConnGraph > |
using | RelabelledTargetGraph = RelabelledGraphWSM< Node, Architecture::UndirectedConnGraph > |
using | BimapValue = boost::bimap< Qubit, Node >::value_type |
using | dist_vec = graphs::dist_vec |
typedef std::shared_ptr< Architecture > | ArchitecturePtr |
typedef std::pair< Edge, Edge > | edge_pair_t |
typedef double | gate_error_t |
typedef double | readout_error_t |
typedef std::map< Node, gate_error_t > | avg_node_errors_t |
typedef std::map< Node, readout_error_t > | avg_readout_errors_t |
typedef std::map< std::pair< Node, Node >, gate_error_t > | avg_link_errors_t |
typedef std::map< OpType, gate_error_t > | op_errors_t |
typedef std::map< Node, op_errors_t > | op_node_errors_t |
typedef std::map< std::pair< Node, Node >, op_errors_t > | op_link_errors_t |
typedef std::shared_ptr< CompositeGateDef > | composite_def_ptr_t |
typedef std::vector< EdgeVec > | BundleVec |
typedef std::vector< Slice > | SliceVec |
typedef std::vector< VertPort > | QPathDetailed |
typedef std::unordered_map< Vertex, Vertex > | vertex_map_t |
typedef std::map< Edge, Edge > | edge_map_t |
typedef boost::multi_index::multi_index_container< BoundaryElement, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< TagID >, boost::multi_index::member< BoundaryElement, UnitID, &BoundaryElement::id_ > >, boost::multi_index::ordered_unique< boost::multi_index::tag< TagIn >, boost::multi_index::member< BoundaryElement, Vertex, &BoundaryElement::in_ > >, boost::multi_index::ordered_unique< boost::multi_index::tag< TagOut >, boost::multi_index::member< BoundaryElement, Vertex, &BoundaryElement::out_ > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< TagType >, boost::multi_index::const_mem_fun< BoundaryElement, UnitType, &BoundaryElement::type > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< TagReg >, boost::multi_index::const_mem_fun< BoundaryElement, std::string, &BoundaryElement::reg_name > > > > | boundary_t |
typedef std::unordered_map< unsigned, unsigned > | permutation_t |
typedef boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, boost::property< boost::vertex_index_t, std::size_t, VertexProperties >, EdgeProperties > | DAG |
Graph representing a circuit, with operations as nodes. | |
typedef boost::graph_traits< DAG >::vertex_descriptor | Vertex |
typedef boost::graph_traits< DAG >::vertex_iterator | V_iterator |
typedef std::unordered_set< Vertex > | VertexSet |
typedef std::vector< Vertex > | VertexVec |
typedef std::list< Vertex > | VertexList |
typedef std::unordered_map< Vertex, std::size_t > | IndexMap |
typedef boost::adj_list_vertex_property_map< DAG, std::size_t, std::size_t &, boost::vertex_index_t > | VIndex |
typedef std::pair< std::size_t, Vertex > | IVertex |
A vertex with an index. | |
typedef boost::graph_traits< DAG >::edge_descriptor | Edge |
typedef boost::graph_traits< DAG >::edge_iterator | E_iterator |
typedef DAG::in_edge_iterator | E_in_iterator |
typedef DAG::out_edge_iterator | E_out_iterator |
typedef std::set< Edge > | EdgeSet |
typedef std::vector< Edge > | EdgeVec |
typedef std::list< Edge > | EdgeList |
typedef std::pair< Vertex, port_t > | VertPort |
typedef std::map< std::vector< bool >, Op_ptr > | ctrl_op_map_t |
Map bitstrings to Ops. | |
typedef std::map< std::vector< bool >, std::vector< Op_ptr > > | ctrl_tensored_op_map_t |
Map bitstrings to tensored Ops. | |
typedef Eigen::VectorXcd | StateVector |
typedef VertexVec | Slice |
typedef sequenced_map_t< UnitID, Edge > | unit_frontier_t |
typedef sequenced_map_t< Bit, EdgeVec > | b_frontier_t |
typedef std::map< std::vector< bool >, std::vector< bool > > | state_perm_t |
Map bitstrings to bitstrings. | |
typedef std::map< std::vector< bool >, Expr > | PhasePolynomial |
PhasePolynomial is just a sequence of parities: that is, terms of the form \( e^{\alpha \bigotimes Z} \), where Z is a Pauli Z. | |
typedef std::pair< std::vector< bool >, Expr > | phase_term_t |
typedef std::map< SpPauliString, Expr > | QubitOperator |
QubitOperator, defined to be useful for diagonalisation and partitioning. | |
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, SpPauliString > | PauliACGraph |
A PauliACGraph is a graph where each vertex is a Pauli tensor, and an edge corresponds to anticommuting tensors. | |
typedef boost::graph_traits< PauliACGraph >::vertex_descriptor | PauliACVertex |
typedef std::shared_ptr< const Gate > | Gate_ptr |
typedef std::map< Node, Node > | interacting_nodes_t |
typedef std::pair< Node, Node > | swap_t |
typedef std::set< swap_t > | swap_set_t |
typedef std::vector< std::size_t > | lexicographical_distances_t |
typedef sequenced_bimap_t< UnitID, VertPort > | unit_vertport_frontier_t |
typedef std::shared_ptr< MappingFrontier > | MappingFrontier_ptr |
typedef std::shared_ptr< const RoutingMethod > | RoutingMethodPtr |
typedef struct tket::ClRegVar | ClRegVar |
A register variable within an expression. | |
typedef std::variant< ClBitVar, ClRegVar > | ClExprVar |
A (bit or register) variable within an expression. | |
typedef std::variant< uint64_t, ClExprVar > | ClExprTerm |
A term in a classical expression (either a constant or a variable) | |
typedef std::variant< ClExprTerm, ClExpr > | ClExprArg |
An argument to a classical operation in an expression. | |
typedef unsigned | port_t |
A specific entry or exit port of a vertex. | |
typedef std::shared_ptr< const Op > | Op_ptr |
typedef std::vector< EdgeType > | op_signature_t |
typedef std::optional< unsigned > | OptUInt |
Optional unsigned integer. | |
typedef std::unordered_set< OpType > | OpTypeSet |
Set of operation types. | |
typedef std::vector< OpType > | OpTypeVector |
Vector of operation types. | |
typedef boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, boost::property< boost::vertex_index_t, int, PauliGadgetProperties >, DependencyEdgeProperties > | PauliDAG |
typedef boost::graph_traits< PauliDAG >::vertex_descriptor | PauliVert |
typedef boost::graph_traits< PauliDAG >::edge_descriptor | PauliEdge |
typedef sequence_set_t< PauliVert > | PauliVertSet |
typedef sequence_set_t< PauliEdge > | PauliEdgeSet |
typedef boost::adj_list_vertex_property_map< PauliDAG, int, int &, boost::vertex_index_t > | PauliVIndex |
typedef std::list< std::pair< OpType, qubit_vector_t > > | Conjugations |
typedef std::map< std::type_index, PredicatePtr > | PredicatePtrMap |
typedef std::pair< const std::type_index, PredicatePtr > | TypePredicatePair |
typedef std::map< std::type_index, std::pair< PredicatePtr, bool > > | PredicateCache |
typedef std::shared_ptr< BasePass > | PassPtr |
typedef std::map< std::type_index, Guarantee > | PredicateClassGuarantees |
typedef std::pair< PredicatePtrMap, PostConditions > | PassConditions |
typedef std::function< void(const CompilationUnit &, const nlohmann::json &)> | PassCallback |
typedef std::shared_ptr< Predicate > | PredicatePtr |
typedef boost::multi_index::multi_index_container< InteractionPoint, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag< TagKey >, boost::multi_index::const_mem_fun< InteractionPoint, std::pair< Edge, Vertex >, &InteractionPoint::key > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< TagEdge >, boost::multi_index::member< InteractionPoint, Edge, &InteractionPoint::e > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< TagSource >, boost::multi_index::member< InteractionPoint, Vertex, &InteractionPoint::source > > > > | interaction_table_t |
Stores all current InteractionPoints encountered. | |
typedef std::complex< double > | Complex |
Complex number. | |
typedef std::tuple< Eigen::MatrixXcd, Eigen::MatrixXcd, Eigen::MatrixXcd, Eigen::MatrixXcd, Eigen::MatrixXd, Eigen::MatrixXd > | csd_t |
Cosine-sine decomposition. | |
typedef SymEngine::Expression | Expr |
Representation of a phase as a multiple of \( \pi \). | |
typedef SymEngine::RCP< const SymEngine::Basic > | ExprPtr |
Shared pointer to an Expr . | |
typedef SymEngine::RCP< const SymEngine::Symbol > | Sym |
Shared pointer to a free symbol. | |
typedef std::set< Sym, SymCompareLess > | SymSet |
typedef std::map< Sym, Expr, SymEngine::RCPBasicKeyLess > | symbol_map_t |
Map from symbols to expressions. | |
typedef std::vector< std::deque< bool > > | GrayCode |
typedef Eigen::Matrix< bool, Eigen::Dynamic, Eigen::Dynamic > | MatrixXb |
typedef Eigen::Matrix< bool, Eigen::Dynamic, 1 > | VectorXb |
typedef Eigen::Matrix< bool, 2, 1 > | Vector2b |
typedef Eigen::Matrix< std::complex< double >, 8, 8 > | Matrix8cd |
typedef Eigen::Triplet< std::complex< double > > | TripletCd |
It is sometimes more convenient to deal with Triplets directly, rather than sparse matrices. | |
typedef Eigen::SparseMatrix< std::complex< double > > | SparseMatrixXcd |
typedef Eigen::SparseMatrix< Complex, Eigen::ColMajor > | CmplxSpMat |
typedef unsigned | quarter_turns_t |
A fourth root of unity {1, i, -1, -i}, represented as an unsigned integer giving the power of i. | |
typedef std::map< Qubit, Pauli > | QubitPauliMap |
A sparse, Qubit-indexed Pauli container. | |
typedef std::vector< Pauli > | DensePauliMap |
A dense, unsigned-indexed Pauli container. | |
typedef PauliTensor< QubitPauliMap, no_coeff_t > | SpPauliString |
typedef PauliTensor< DensePauliMap, no_coeff_t > | PauliString |
typedef PauliTensor< QubitPauliMap, quarter_turns_t > | SpPauliStabiliser |
typedef PauliTensor< DensePauliMap, quarter_turns_t > | PauliStabiliser |
typedef PauliTensor< QubitPauliMap, Complex > | SpCxPauliTensor |
typedef PauliTensor< DensePauliMap, Complex > | CxPauliTensor |
typedef PauliTensor< QubitPauliMap, Expr > | SpSymPauliTensor |
typedef PauliTensor< DensePauliMap, Expr > | SymPauliTensor |
typedef std::vector< PauliStabiliser > | PauliStabiliserVec |
template<typename A , typename B > | |
using | sequenced_bimap_t = boost::multi_index::multi_index_container< std::pair< A, B >, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< TagKey >, boost::multi_index::member< std::pair< A, B >, A, &std::pair< A, B >::first > >, boost::multi_index::ordered_unique< boost::multi_index::tag< TagValue >, boost::multi_index::member< std::pair< A, B >, B, &std::pair< A, B >::second > >, boost::multi_index::sequenced< boost::multi_index::tag< TagSeq > > > > |
template<typename A , typename B > | |
using | sequenced_map_t = boost::multi_index::multi_index_container< std::pair< A, B >, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< TagKey >, boost::multi_index::member< std::pair< A, B >, A, &std::pair< A, B >::first > >, boost::multi_index::sequenced< boost::multi_index::tag< TagSeq > > > > |
template<typename T > | |
using | sequence_set_t = boost::multi_index::multi_index_container< T, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< TagKey >, boost::multi_index::identity< T > >, boost::multi_index::sequenced< boost::multi_index::tag< TagSeq > > > > |
typedef std::pair< UnitType, unsigned > | register_info_t |
The type and dimension of a register. | |
typedef std::optional< register_info_t > | opt_reg_info_t |
typedef boost::bimap< UnitID, UnitID > | unit_bimap_t |
A correspondence between two sets of unit IDs. | |
typedef std::vector< UnitID > | unit_vector_t |
typedef std::map< UnitID, UnitID > | unit_map_t |
typedef std::set< UnitID > | unit_set_t |
typedef std::vector< Qubit > | qubit_vector_t |
typedef std::map< Qubit, Qubit > | qubit_map_t |
typedef std::vector< Bit > | bit_vector_t |
typedef std::map< Bit, Bit > | bit_map_t |
typedef std::set< Node > | node_set_t |
typedef std::vector< Node > | node_vector_t |
typedef std::map< unsigned, UnitID > | register_t |
A register of locations sharing the same name. | |
Enumerations | |
enum class | VertexType { Quantum , Classical , Measure } |
enum class | RecursionNodeType { Left = 0 , Right = 1 , Root = 2 } |
Indicates whether a recursion step in recursive_demultiplex_rotation is either a left child, a right child, or the root. More... | |
enum class | ZXPortType { In , Out } |
enum | ReverseType { dagger = 1 , transpose = 2 } |
enum class | PortType { Source , Target } |
Whether a vertex port is out-going (source) or in-coming (target) More... | |
enum class | ToffoliBoxSynthStrat { Matching , Cycle } |
Strategies for synthesising ToffoliBoxes Matching: use multiplexors to perform parallel swaps on hypercubes Cycle: use CnX gates to perform transpositions. More... | |
enum class | PauliPartitionStrat { NonConflictingSets , CommutingSets } |
A choice of strategies to partition Pauli tensors into sets. More... | |
enum class | GraphColourMethod { Lazy , LargestFirst , Exhaustive } |
A choice of methods to perform graph colouring for Pauli partitioning. More... | |
enum class | ClOp { INVALID , BitAnd , BitOr , BitXor , BitEq , BitNeq , BitNot , BitZero , BitOne , RegAnd , RegOr , RegXor , RegEq , RegNeq , RegNot , RegZero , RegOne , RegLt , RegGt , RegLeq , RegGeq , RegAdd , RegSub , RegMul , RegDiv , RegPow , RegLsh , RegRsh , RegNeg } |
An function acting on bits or bit registers. More... | |
enum class | EdgeType { Quantum , Classical , Boolean , WASM } |
Type of a wire in a circuit or input to an op. More... | |
enum class | OpType { Input , Output , Create , Discard , ClInput , ClOutput , WASMInput , WASMOutput , Barrier , Label , Branch , Goto , Stop , ClassicalTransform , WASM , SetBits , CopyBits , RangePredicate , ExplicitPredicate , ExplicitModifier , MultiBit , Phase , Z , X , Y , S , Sdg , T , Tdg , V , Vdg , SX , SXdg , H , Rx , Ry , Rz , U3 , U2 , U1 , GPI , GPI2 , AAMS , TK1 , TK2 , CX , CY , CZ , CH , CV , CVdg , CSX , CSXdg , CS , CSdg , CRz , CRx , CRy , CU1 , CU3 , PhaseGadget , CCX , SWAP , CSWAP , BRIDGE , noop , Measure , Collapse , Reset , ECR , ISWAP , PhasedX , NPhasedX , ZZMax , XXPhase , YYPhase , ZZPhase , XXPhase3 , ESWAP , FSim , Sycamore , ISWAPMax , PhasedISWAP , CnRy , CnRx , CnRz , CnX , CnZ , CnY , CircBox , Unitary1qBox , Unitary2qBox , Unitary3qBox , ExpBox , PauliExpBox , PauliExpPairBox , PauliExpCommutingSetBox , TermSequenceBox , CliffBox , CustomGate , PhasePolyBox , QControlBox , MultiplexorBox , MultiplexedRotationBox , MultiplexedU2Box , MultiplexedTensoredU2Box , StatePreparationBox , DiagonalBox , ConjugationBox , Conditional , ProjectorAssertionBox , StabiliserAssertionBox , ToffoliBox , UnitaryTableauBox , DummyBox , ClExpr } |
Named operation types. More... | |
enum class | Guarantee { Clear , Preserve } |
enum class | SafetyMode { Audit , Default , Off } |
enum class | BasisOrder { ilo , dlo } |
Enum for readout basis and ordering. More... | |
enum | Pauli { I = 0 , X , Y , Z } |
Symbols for the Pauli operators (and identity) More... | |
enum class | CXConfigType { Snake , Tree , Star , MultiQGate } |
Whenever a decomposition choice of Pauli gadgets is presented, users may use either Snake (a.k.a. More... | |
enum class | UnitType { Qubit , Bit , WasmState } |
Type of information held. More... | |
Functions | |
int | tri_lexicographical_comparison (const std::vector< std::size_t > &dist1, const std::vector< std::size_t > &dist2) |
void | to_json (nlohmann::json &j, const Architecture::Connection &link) |
void | from_json (const nlohmann::json &j, Architecture::Connection &link) |
void | to_json (nlohmann::json &j, const Architecture &ar) |
void | from_json (const nlohmann::json &j, Architecture &ar) |
void | to_json (nlohmann::json &j, const FullyConnected &ar) |
void | from_json (const nlohmann::json &j, FullyConnected &ar) |
void | to_json (nlohmann::json &j, const DeviceCharacterisation &dc) |
void | from_json (const nlohmann::json &j, DeviceCharacterisation &dc) |
void | add_noop_frames (std::vector< Cycle > &cycles, Circuit &circ) |
std::vector< std::vector< OpTypeVector > > | get_all_frame_permutations (const unsigned &max_frame_size, const OpTypeSet &frame_types) |
std::vector< std::vector< OpTypeVector > > | combine_vectors (const std::vector< std::vector< OpTypeVector > > &vec_0, const std::vector< OpTypeVector > &vec_1) |
std::vector< std::vector< OpTypeVector > > | get_all_permutation_combinations (const std::vector< unsigned > &frame_sizes, const std::vector< std::vector< OpTypeVector > > &frame_permutations) |
std::pair< std::vector< unsigned >, unsigned > | get_frame_sizes (const std::vector< Cycle > &cycles) |
std::tuple< Circuit, std::vector< bool > > | projector_assertion_synthesis (const Eigen::MatrixXcd &P) |
Synthesise an assertion circuit from an arbitrary 2x2, 4x4 or 8x8 projector matrix. | |
std::tuple< Circuit, std::vector< bool > > | stabiliser_assertion_synthesis (const PauliStabiliserVec &paulis) |
Synthesise an assertion circuit from a list of Paulis strings with +/-1 coefficients. | |
std::ostream & | operator<< (std::ostream &out, const Circuit &circ) |
nlohmann::json | core_box_json (const Box &box) |
void | to_json (nlohmann::json &j, const composite_def_ptr_t &cdef) |
void | from_json (const nlohmann::json &j, composite_def_ptr_t &cdef) |
void | to_json (nlohmann::json &j, const Circuit &circ) |
void | from_json (const nlohmann::json &j, Circuit &circ) |
Eigen::Matrix2cd | get_matrix (const Circuit &circ, const Vertex &vert) |
Convert a vertex holding a TK1 operation to its corresponding matrix. | |
Eigen::Matrix2cd | get_matrix_from_circ (const Circuit &circ) |
Convert a one-qubit circuit of TK1 operations to its corresponding matrix. | |
Eigen::Matrix4cd | get_matrix_from_2qb_circ (const Circuit &circ) |
Convert a two-qubit circuit to its corresponding matrix. | |
Circuit | two_qubit_canonical (const Eigen::Matrix4cd &U, OpType target_2qb_gate=OpType::TK2) |
Convert a 4x4 unitary matrix optimally to a corresponding circuit. | |
std::pair< Circuit, Complex > | decompose_2cx_VD (const Eigen::Matrix4cd &U) |
Decompose a unitary matrix into a 2-CX circuit following a diagonal operator. | |
std::pair< Circuit, Complex > | decompose_2cx_DV (const Eigen::Matrix4cd &U) |
Decompose a unitary matrix into a 2-CXs preceding a diagonal operator. | |
Circuit | phase_gadget (unsigned n_qubits, const Expr &angle, CXConfigType cx_config=CXConfigType::Snake) |
Construct a phase gadget. | |
Circuit | pauli_gadget (SpSymPauliTensor pauli, CXConfigType cx_config=CXConfigType::Snake) |
Construct a 'Pauli gadget' corresponding to a tensor of Pauli operators. | |
Circuit | pauli_gadget_pair (SpSymPauliTensor paulis0, SpSymPauliTensor paulis1, CXConfigType cx_config=CXConfigType::Snake) |
Construct a circuit realising a pair of Pauli gadgets with the fewest two-qubit gates. | |
void | replace_CX_with_TK2 (Circuit &c) |
Utility function to replace all CX gates with TK2 and single-qubit gates. | |
Circuit | with_TK2 (Gate_ptr op) |
Express a gate as a circuit using TK2 as the only multi-qubit gate. | |
Circuit | with_CX (Gate_ptr op) |
Express a gate as a circuit using CX as the only multi-qubit gate. | |
Circuit | with_controls (const Circuit &c, unsigned n_controls=1) |
Construct a controlled version of a given circuit. | |
std::tuple< Circuit, std::array< Expr, 3 >, Circuit > | normalise_TK2_angles (Expr a, Expr b, Expr c) |
Get normalised TK2 angles and local change of basis for normalisation. | |
void | to_json (nlohmann::json &j, const Command &com) |
void | from_json (const nlohmann::json &j, Command &com) |
bool | is_valid (const DAG &G) |
Check that the DAG satisfies the requirements of the Circuit class. | |
void | add_latex_for_command (LatexContext &context, const Command &command) |
boundary_t::iterator | boundary_elem (const Circuit &circ, const UnitID &unit) |
Circuit | operator* (const Circuit &c1, const Circuit &c2) |
Circuit | operator>> (const Circuit &ci1, const Circuit &ci2) |
Circuit | recursive_conditional_circuit (const Op_ptr &op, const Circuit &base_circ) |
void | add_cx_u1 (Circuit &circ, const std::vector< MultiplexedU2Commands > &m_u2_decomps, unsigned n_controls_, unsigned n_targets_) |
std::pair< ctrl_op_map_t, Eigen::VectorXcd > | disentangle_final_qubit_from_diagonal (const Eigen::VectorXcd &full_diag, unsigned n_controls_) |
void | add_multi_rz (Circuit &circ, const std::vector< ctrl_op_map_t > &all_multiplexed_rz, unsigned n_controls_, unsigned n_targets_) |
Eigen::VectorXcd | combine_diagonals (const std::vector< Eigen::VectorXcd > &all_diags, unsigned n_controls_, unsigned n_targets_) |
void | from_json (const nlohmann::json &j, Op_ptr &op) |
DensePauliMap | pad_sparse_pauli_map (const QubitPauliMap &sparse_string, size_t size) |
void | append_single_pauli_gadget_as_pauli_exp_box (Circuit &circ, const SpSymPauliTensor &pauli, CXConfigType cx_config) |
Constructs a PauliExpBox for a single pauli gadget and appends it to a circuit. | |
void | append_pauli_gadget_pair_as_box (Circuit &circ, const SpSymPauliTensor &pauli0, const SpSymPauliTensor &pauli1, CXConfigType cx_config) |
Constructs a PauliExpPairBox for a pair of pauli gadgets and appends it to a circuit. | |
void | append_commuting_pauli_gadget_set_as_box (Circuit &circ, const std::list< SpSymPauliTensor > &gadgets, CXConfigType cx_config) |
Constructs a PauliExpCommutingSetBox for a set of mutually commuting pauli gadgets and appends it to a circuit. | |
void | to_json (nlohmann::json &j, const ResourceData &data) |
void | from_json (const nlohmann::json &j, ResourceData &data) |
Circuit | three_qubit_synthesis (const Eigen::MatrixXcd &U) |
Synthesise a 3-qubit circuit from an arbitrary 8x8 unitary. | |
Circuit | three_qubit_tk_synthesis (const Eigen::MatrixXcd &U) |
Synthesise a 3-qubit circuit from an arbitrary 8x8 unitary. | |
Eigen::MatrixXcd | get_3q_unitary (const Circuit &c) |
Convert a 3-qubit circuit to its corresponding unitary matrix. | |
Circuit | get_bitstring_circuit (const std::vector< bool > &bitstring, const unsigned &target, const unsigned &n_qubits) |
std::ostream & | operator<< (std::ostream &os, const ChoiMixTableau &tab) |
void | to_json (nlohmann::json &j, const ChoiMixTableau::TableauSegment &seg) |
void | from_json (const nlohmann::json &j, ChoiMixTableau::TableauSegment &seg) |
void | to_json (nlohmann::json &j, const ChoiMixTableau &tab) |
void | from_json (const nlohmann::json &j, ChoiMixTableau &tab) |
std::ostream & | operator<< (std::ostream &os, const SymplecticTableau &tab) |
void | to_json (nlohmann::json &j, const SymplecticTableau &tab) |
void | from_json (const nlohmann::json &j, SymplecticTableau &tab) |
std::ostream & | operator<< (std::ostream &os, const UnitaryTableau &tab) |
void | to_json (nlohmann::json &j, const UnitaryTableau &tab) |
void | from_json (const nlohmann::json &j, UnitaryTableau &tab) |
std::ostream & | operator<< (std::ostream &os, const UnitaryRevTableau &tab) |
void | to_json (nlohmann::json &j, const UnitaryRevTableau &tab) |
void | from_json (const nlohmann::json &j, UnitaryRevTableau &tab) |
ChoiMixTableau | circuit_to_cm_tableau (const Circuit &circ) |
Construct a ChoiMixTableau for a given circuit. | |
std::pair< Circuit, qubit_map_t > | cm_tableau_to_exact_circuit (const ChoiMixTableau &tab, CXConfigType cx_config=CXConfigType::Snake) |
Constructs a circuit producing the same effect as a ChoiMixTableau. | |
std::pair< Circuit, qubit_map_t > | cm_tableau_to_unitary_extension_circuit (const ChoiMixTableau &tab, const std::vector< Qubit > &init_names={}, const std::vector< Qubit > &post_names={}, CXConfigType cx_config=CXConfigType::Snake) |
We define a unitary extension of a ChoiMixTableau to be a unitary circuit whose stabilizer group contain all the rows of the ChoiMixTableau and possibly more. | |
std::ostream & | operator<< (std::ostream &out, const DiagMatrix &diam) |
PauliGraph | circuit_to_pauli_graph (const Circuit &circ) |
Circuit | pauli_graph_to_pauli_exp_box_circuit_individually (const PauliGraph &pg, CXConfigType cx_config=CXConfigType::Snake) |
Synthesises a circuit equivalent to the PauliGraph by adding each pauli gadget to the circuit as a PauliExpBox individually in the order given by TopSortIterator. | |
Circuit | pauli_graph_to_pauli_exp_box_circuit_pairwise (const PauliGraph &pg, CXConfigType cx_config=CXConfigType::Snake) |
Synthesises a circuit equivalent to the PauliGraph by inserting pairs of pauli gadgets as PauliExpPairBoxes into the circuit The tableau is then synthesised at the end. | |
Circuit | pauli_graph_to_pauli_exp_box_circuit_sets (const PauliGraph &pg, CXConfigType cx_config=CXConfigType::Snake) |
Synthesises a circuit equivalent to the PauliGraph by building sets of mutually commuting pauli gadgets and inserting them into the circuit as PauliExpCommutingSetBoxes The tableau is then synthesised at the end. | |
Circuit | gray_synth (unsigned n_qubits, const std::list< phase_term_t > &parities, const MatrixXb &linear_transformation) |
template<typename T > | |
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > | load_dynamic_matrix (const nlohmann::json &j, std::size_t rows, std::size_t cols) |
UnitaryTableau | circuit_to_unitary_tableau (const Circuit &circ) |
Construct the tableau for a given circuit. | |
Circuit | unitary_tableau_to_circuit (const UnitaryTableau &tab) |
Constructs a circuit producing the same effect as the tableau. | |
UnitaryRevTableau | circuit_to_unitary_rev_tableau (const Circuit &circ) |
Circuit | unitary_rev_tableau_to_circuit (const UnitaryRevTableau &tab) |
bool | is_spiderless_optype (const OpType &optype) |
std::pair< ZXVertPort, ZXVertPort > | add_switch (ZXDiagram &zxd, const bool &on_value, const QuantumType &qtype) |
std::pair< std::pair< ZXVertPort, ZXVertPort >, ZXVertPortVec > | add_conditional_zx (ZXDiagram &zxd, const ZXVert &left, const ZXVert &right, const QuantumType &qtype) |
std::pair< ZXVertPortVec, ZXVertPort > | add_n_bit_and (ZXDiagram &zxd, unsigned n, const QuantumType &qtype) |
BoundaryVertMap | circuit_to_zx_recursive (const Circuit &circ, ZXDiagram &zxd, bool add_boundary) |
std::pair< ZXDiagram, BoundaryVertMap > | circuit_to_zx (const Circuit &circuit) |
Construct a zx diagram from a given circuit. | |
void | clean_frontier (ZXDiagram &diag, ZXVertVec &frontier, Circuit &circ, std::map< ZXVert, unsigned > &qubit_map, std::map< ZXVert, ZXVert > &input_qubits) |
ZXVertSeqSet | neighbours_of_frontier (const ZXDiagram &diag, const ZXVertVec &frontier) |
void | extend_if_input (ZXDiagram &diag, const ZXVert &v, std::map< ZXVert, ZXVert > &input_qubits) |
bool | remove_all_gadgets (ZXDiagram &diag, const ZXVertVec &frontier, std::map< ZXVert, ZXVert > &input_qubits) |
Circuit | zx_to_circuit (const zx::ZXDiagram &diag) |
Takes a unitary ZX diagram in MBQC form with the promise that a gflow exists. | |
void | check_easy_diagonalise (std::list< SpSymPauliTensor > &gadgets, std::set< Qubit > &qubits, Circuit &circ) |
Check whether there are any qubits which only requires a single qubit Clifford to make all Paulis I or Z. | |
std::optional< std::pair< Pauli, Pauli > > | check_pair_compatibility (const Qubit &qb1, const Qubit &qb2, const std::list< SpSymPauliTensor > &gadgets) |
Given two qubits, attempt to find a basis in which a single CX will make the Paulis on one of qubits fully diagonal. | |
void | greedy_diagonalise (const std::list< SpSymPauliTensor > &gadgets, std::set< Qubit > &qubits, Conjugations &conjugations, Circuit &circ, CXConfigType cx_config) |
Diagonalise a qubit greedily by finding the Pauli Gadget with the lowest residual support over the non-diagonal qubits, and apply single qubit Cliffords and CXs to make it a ZIII...I string. | |
Circuit | mutual_diagonalise (std::list< SpSymPauliTensor > &gadgets, std::set< Qubit > qubits, CXConfigType cx_config) |
Diagonalise a mutually commuting set of Pauli strings. | |
void | apply_conjugations (SpSymPauliTensor &qps, const Conjugations &conjugations) |
Applies Clifford conjugations to a SpSymPauliTensor. | |
std::pair< Circuit, Qubit > | reduce_pauli_to_z (const SpPauliStabiliser &pauli, CXConfigType cx_config) |
Given a Pauli tensor P, produces a short Clifford circuit C which maps P to Z on a single qubit, i.e. | |
std::pair< Circuit, std::optional< Qubit > > | reduce_overlap_of_paulis (SpPauliStabiliser &pauli0, SpPauliStabiliser &pauli1, CXConfigType cx_config, bool allow_matching_final=false) |
Given a pair of (either commuting or anticommuting) Pauli tensors P0, P1, produces a short Clifford circuit C which maps P0 and P1 to strings which overlap on at most one qubit (which is also returned). | |
std::pair< Circuit, Qubit > | reduce_anticommuting_paulis_to_z_x (SpPauliStabiliser pauli0, SpPauliStabiliser pauli1, CXConfigType cx_config) |
Given a pair of anticommuting Pauli tensors P0, P1, produces a short Clifford circuit C which maps P0 to Z and P1 to X on the same qubit, i.e. | |
std::tuple< Circuit, Qubit, Qubit > | reduce_commuting_paulis_to_zi_iz (SpPauliStabiliser pauli0, SpPauliStabiliser pauli1, CXConfigType cx_config) |
Given a pair of commuting Pauli tensors P0, P1, produces a short Clifford circuit C which maps P0 and P1 to Z on different qubits, i.e. | |
void | insert_into_gadget_map (QubitOperator &gadget_map, const PauliGadgetProperties &pgp) |
std::list< std::list< SpPauliString > > | term_sequence (const std::list< SpPauliString > &strings, PauliPartitionStrat strat, GraphColourMethod method=GraphColourMethod::Lazy) |
Partitions a QubitOperator into lists of mutually commuting gadgets. | |
Gate_ptr | as_gate_ptr (Op_ptr op) |
Cast a general Op (of gate type) to a Gate . | |
Op_ptr | get_op_ptr (OpType chosen_type, const Expr ¶m, unsigned n_qubits=0) |
Get an operation with a given type, single parameter and qubit count. | |
Op_ptr | get_op_ptr (OpType chosen_type, const std::vector< Expr > ¶ms={}, unsigned n_qubits=0) |
Get an operation from a type, vector of parameters and qubit count. | |
std::ostream & | operator<< (std::ostream &os, const Rotation &q) |
std::vector< double > | tk1_angles_from_unitary (const Eigen::Matrix2cd &U) |
Construct TK1 angles and phase from matrix. | |
std::tuple< double, double, double > | get_bloch_coordinate_from_state (const Complex &a, const Complex &b) |
Get the bloch sphere coordinate of a 1-qubit state. | |
Eigen::Matrix2cd | get_matrix_from_tk1_angles (std::vector< Expr > params) |
Construct matrix from TK1 angles and phase. | |
bool | is_vertex_CX (const Circuit &circ_, const Vertex &v) |
UnitID | get_unitid_from_unit_frontier (const std::shared_ptr< unit_vertport_frontier_t > &u_frontier, const VertPort &vp) |
unit_vertport_frontier_t is <UnitID, VertPort>, helper function returns UnitID corresponding to given VertPort | |
std::shared_ptr< unit_frontier_t > | frontier_convert_vertport_to_edge (const Circuit &circuit, const std::shared_ptr< unit_vertport_frontier_t > &u_frontier) |
linear_boundary stored as vertport so that correct edge can be recovered after subcircuit substitution method uses Vertex and port_t and Circuit::get_nth_out_edge to generate unit_frontier_t object | |
EdgeVec | convert_u_frontier_to_edges (const unit_frontier_t &u_frontier) |
convert_u_frontier_to_edges Subcircuit requires EdgeVec, not unit_frontier_t as boundary information Helper Functions to convert types | |
EdgeVec | convert_b_frontier_to_edges (const b_frontier_t &b_frontier) |
void | to_json (nlohmann::json &j, const RoutingMethod &rm) |
void | from_json (const nlohmann::json &, RoutingMethod &rm) |
void | to_json (nlohmann::json &j, const std::vector< RoutingMethodPtr > &rmp_v) |
void | from_json (const nlohmann::json &j, std::vector< RoutingMethodPtr > &rmp_v) |
bool | respects_connectivity_constraints (const Circuit &circ, const Architecture &arch, bool directed, bool bridge_allowed=false) |
Check that the circuit respects architectural constraints. | |
MeasurementSetup | measurement_reduction (const std::list< SpPauliString > &strings, PauliPartitionStrat strat, GraphColourMethod method=GraphColourMethod::Lazy, CXConfigType cx_config=CXConfigType::Snake) |
A tool for reducing the number of measurements required for variational quantum algorithms by partitioning Pauli strings into mutually commuting sets. | |
void | to_json (nlohmann::json &j, const MeasurementSetup::MeasurementBitMap &result) |
void | from_json (const nlohmann::json &j, MeasurementSetup::MeasurementBitMap &result) |
void | to_json (nlohmann::json &j, const MeasurementSetup &setup) |
void | from_json (const nlohmann::json &j, MeasurementSetup &setup) |
std::shared_ptr< ClassicalTransformOp > | ClassicalX () |
Classical NOT transform. | |
std::shared_ptr< ClassicalTransformOp > | ClassicalCX () |
Classical CNOT transform. | |
std::shared_ptr< ExplicitPredicateOp > | NotOp () |
Unary NOT operator. | |
std::shared_ptr< ExplicitPredicateOp > | AndOp () |
Binary AND operator. | |
std::shared_ptr< ExplicitPredicateOp > | OrOp () |
Binary OR operator. | |
std::shared_ptr< ExplicitPredicateOp > | XorOp () |
Binary XOR operator. | |
std::shared_ptr< ExplicitModifierOp > | AndWithOp () |
In-place AND with another input. | |
std::shared_ptr< ExplicitModifierOp > | OrWithOp () |
In-place OR with another input. | |
std::shared_ptr< ExplicitModifierOp > | XorWithOp () |
In-place XOR with another input. | |
std::ostream & | operator<< (std::ostream &os, ClOp fn) |
std::ostream & | operator<< (std::ostream &os, const ClBitVar &var) |
std::ostream & | operator<< (std::ostream &os, const ClRegVar &var) |
std::ostream & | operator<< (std::ostream &os, const ClExprVar &var) |
void | to_json (nlohmann::json &j, const ClExprVar &var) |
void | from_json (const nlohmann::json &j, ClExprVar &var) |
std::ostream & | operator<< (std::ostream &os, const ClExprTerm &term) |
void | to_json (nlohmann::json &j, const ClExprTerm &term) |
void | from_json (const nlohmann::json &j, ClExprTerm &term) |
std::ostream & | operator<< (std::ostream &os, const ClExprArg &arg) |
void | to_json (nlohmann::json &j, const ClExprArg &arg) |
void | from_json (const nlohmann::json &j, ClExprArg &arg) |
std::ostream & | operator<< (std::ostream &os, const ClExpr &expr) |
void | to_json (nlohmann::json &j, const ClExpr &expr) |
void | from_json (const nlohmann::json &j, ClExpr &expr) |
std::ostream & | operator<< (std::ostream &os, const WiredClExpr &expr) |
void | to_json (nlohmann::json &j, const WiredClExpr &expr) |
void | from_json (const nlohmann::json &j, WiredClExpr &expr) |
std::ostream & | operator<< (std::ostream &os, Op const &operation) |
void | to_json (nlohmann::json &j, const Op_ptr &op) |
bool | find_in_set (const OpType &val, const OpTypeSet &set) |
Whether a given operation type belongs to a given set. | |
const OpTypeSet & | all_gate_types () |
Set of all elementary gates. | |
const OpTypeSet & | all_multi_qubit_types () |
Set of all gates over more than one qubit. | |
const OpTypeSet & | all_single_qubit_unitary_types () |
Set of all single-qubit gates that can be expressed as TK1. | |
const OpTypeSet & | all_single_qubit_types () |
Set of all gates over a single qubit. | |
const OpTypeSet & | all_classical_types () |
Set of all classical gates. | |
const OpTypeSet & | all_projective_types () |
Set of all measurement and reset gates. | |
const OpTypeSet & | all_controlled_gate_types () |
Set of all controlled gates. | |
bool | is_metaop_type (OpType optype) |
Test for initial and final "ops". | |
bool | is_barrier_type (OpType optype) |
Test for Barrier "ops". | |
bool | is_initial_q_type (OpType optype) |
Test for input or creation quantum "ops". | |
bool | is_final_q_type (OpType optype) |
Test for output or discard quantum "ops". | |
bool | is_initial_type (OpType optype) |
Test for input "ops". | |
bool | is_final_type (OpType optype) |
Test for output "ops". | |
bool | is_boundary_type (OpType optype) |
Test for input, creation, output or discard "ops". | |
bool | is_boundary_q_type (OpType optype) |
Test for input, creation, output or discard quantum "ops". | |
bool | is_boundary_c_type (OpType optype) |
Test for input or output for classical "ops". | |
bool | is_boundary_w_type (OpType optype) |
Test for input or output for wasm "ops". | |
bool | is_gate_type (OpType optype) |
Test for elementary gates. | |
bool | is_box_type (OpType optype) |
Test for boxes (complex packaged operations) | |
bool | is_flowop_type (OpType optype) |
Test for flowops (just for high-level control flow) | |
bool | is_rotation_type (OpType optype) |
Test for rotations (including controlled rotations) | |
bool | is_parameterised_pauli_rotation_type (OpType optype) |
Test for rotations around Pauli axes. | |
bool | is_multi_qubit_type (OpType optype) |
Test for gates over more than one qubit. | |
bool | is_single_qubit_type (OpType optype) |
Test for gates over a single qubit. | |
bool | is_single_qubit_unitary_type (OpType optype) |
Test for single-qubit gates that can be expressed as TK1. | |
bool | is_oneway_type (OpType optype) |
Test for non-invertible operations. | |
bool | is_clifford_type (OpType optype) |
Test for Clifford operations. | |
bool | is_projective_type (OpType optype) |
Test for measurement and reset gates. | |
bool | is_classical_type (OpType optype) |
Test for purely classical gates. | |
bool | is_controlled_gate_type (OpType optype) |
Test for controlled gates. | |
const std::map< OpType, OpTypeInfo > & | optypeinfo () |
Information including name and shape of each operation type. | |
const std::map< std::string, OpType > & | name_to_optype () |
void | to_json (nlohmann::json &j, const OpType &type) |
void | from_json (const nlohmann::json &j, OpType &type) |
std::pair< Pauli, bool > | conjugate_Pauli (OpType op, Pauli p, bool reverse=false) |
Captures rules for conjugating a pauli-gadget with single-qubit Clifford gates Maps gate and pauli to the new pauli after the conjugation and whether or not a phase-flip is induced. | |
void | conjugate_PauliTensor (SpPauliStabiliser &qpt, OpType op, const Qubit &q, bool reverse=false) |
Methods to conjugate a SpPauliStabiliser with Clifford gates to change basis Transforms P to P' such that reverse = false : –P'– = –op–P–opdg– reverse = true : –P'– = –opdg–P–op–. | |
void | conjugate_PauliTensor (SpPauliStabiliser &qpt, OpType op, const Qubit &q0, const Qubit &q1) |
void | conjugate_PauliTensor (SpPauliStabiliser &qpt, OpType op, const Qubit &q0, const Qubit &q1, const Qubit &q2) |
bool | operator< (const PauliGadgetProperties &pgp1, const PauliGadgetProperties &pgp2) |
void | fill_partial_mapping (const qubit_vector_t ¤t_qubits, std::map< Qubit, Node > &partial_mapping) |
void | to_json (nlohmann::json &j, const Placement::Ptr &placement_ptr) |
void | from_json (const nlohmann::json &j, Placement::Ptr &placement_ptr) |
void | trivial_callback (const CompilationUnit &, const nlohmann::json &) |
Default callback when applying a pass (does nothing) | |
PassPtr | operator>> (const PassPtr &lhs, const PassPtr &rhs) |
nlohmann::json | serialise (const BasePass &bp) |
nlohmann::json | serialise (const PassPtr &pp) |
nlohmann::json | serialise (const std::vector< PassPtr > &pp) |
PassPtr | deserialise (const nlohmann::json &j, const std::map< std::string, std::function< Circuit(const Circuit &)> > &custom_deserialise, const std::map< std::string, std::function< std::pair< Circuit, std::pair< unit_map_t, unit_map_t > >(const Circuit &)> > &custom_map_deserialise) |
PassPtr | gen_rebase_pass (const OpTypeSet &allowed_gates, const Circuit &cx_replacement, const std::function< Circuit(const Expr &, const Expr &, const Expr &)> &tk1_replacement) |
PassPtr | gen_rebase_pass_via_tk2 (const OpTypeSet &allowed_gates, const std::function< Circuit(const Expr &, const Expr &, const Expr &)> &tk2_replacement, const std::function< Circuit(const Expr &, const Expr &, const Expr &)> &tk1_replacement) |
Generate a rebase pass give standard replacements for TK1 and TK2 gates. | |
PassPtr | gen_squash_pass (const OpTypeSet &singleqs, const std::function< Circuit(const Expr &, const Expr &, const Expr &)> &tk1_replacement, bool always_squash_symbols) |
PassPtr | gen_auto_rebase_pass (const OpTypeSet &allowed_gates, bool allow_swaps=false) |
Attempt to generate a rebase pass automatically for the given target gateset. | |
PassPtr | gen_auto_squash_pass (const OpTypeSet &singleqs) |
Attempt to generate a squash pass automatically for the given target single qubit gateset. | |
PassPtr | gen_euler_pass (const OpType &q, const OpType &p, bool strict) |
PassPtr | gen_clifford_simp_pass (bool allow_swaps, OpType target_2qb_gate) |
PassPtr | gen_clifford_resynthesis_pass (std::optional< std::function< Circuit(const Circuit &)> > transform=std::nullopt, bool allow_swaps=true) |
Pass to resynthesise Clifford subcircuits and simplify using Clifford rules. | |
PassPtr | gen_clifford_push_through_pass () |
Pass that simplifies circuits by resynthesising Clifford subcircuits before end of circuit measurements as a mutual diagonalisation circuit and classical postprocessing. | |
PassPtr | gen_flatten_relabel_registers_pass (const std::string &label) |
Pass to remove empty Quantum edges from a Circuit and then relabel all Qubit to some new register defined by a passed label. | |
PassPtr | gen_rename_qubits_pass (const std::map< Qubit, Qubit > &qm) |
Pass to rename some or all qubits according to the given map. | |
PassPtr | gen_placement_pass (const Placement::Ptr &placement_ptr) |
PassPtr | gen_naive_placement_pass (const Architecture &arc) |
PassPtr | gen_full_mapping_pass (const Architecture &arc, const Placement::Ptr &placement_ptr, const std::vector< RoutingMethodPtr > &config) |
PassPtr | gen_default_mapping_pass (const Architecture &arc, bool delay_measures) |
PassPtr | gen_cx_mapping_pass (const Architecture &arc, const Placement::Ptr &placement_ptr, const std::vector< RoutingMethodPtr > &config, bool directed_cx, bool delay_measures) |
PassPtr | gen_routing_pass (const Architecture &arc, const std::vector< RoutingMethodPtr > &config) |
PassPtr | gen_placement_pass_phase_poly (const Architecture &arc, unsigned _maximum_matches=2000, unsigned _timeout=100, unsigned _maximum_pattern_gates=100, unsigned _maximum_pattern_depth=100) |
pass to place all not yet placed qubits of the circuit to the given architecture for the architecture aware synthesis. | |
PassPtr | aas_routing_pass (const Architecture &arc, const unsigned lookahead=1, const aas::CNotSynthType cnotsynthtype=aas::CNotSynthType::Rec) |
execute architecture aware synthesis on a given architecture for an allready place circuit, only for circuit which contains Cx+Rz+H gates this pass is not able to handle implicit wire swaps | |
PassPtr | gen_full_mapping_pass_phase_poly (const Architecture &arc, const unsigned lookahead=1, const aas::CNotSynthType cnotsynthtype=aas::CNotSynthType::Rec, unsigned graph_placement_maximum_matches=2000, unsigned graph_placement_timeout=100, unsigned graph_placement_maximum_pattern_gates=2000, unsigned graph_placement_maximum_pattern_depth=2000) |
execute architecture aware synthesis on a given architecture for any circuit. | |
PassPtr | gen_directed_cx_routing_pass (const Architecture &arc, const std::vector< RoutingMethodPtr > &config) |
PassPtr | gen_decompose_routing_gates_to_cxs_pass (const Architecture &arc, bool directed) |
PassPtr | gen_user_defined_swap_decomp_pass (const Circuit &replacement_circ) |
PassPtr | KAKDecomposition (OpType target_2qb_gate=OpType::CX, double cx_fidelity=1., bool allow_swaps=true) |
Squash sequences of two-qubit operations into minimal form. | |
PassPtr | DecomposeTK2 (bool allow_swaps) |
PassPtr | DecomposeTK2 (const Transforms::TwoQbFidelities &fid, bool allow_swaps=true) |
Decomposes each TK2 gate into two-qubit gates. | |
PassPtr | ThreeQubitSquash (bool allow_swaps=true) |
Resynthesize and squash three-qubit interactions. | |
PassPtr | PeepholeOptimise2Q (bool allow_swaps=true) |
Performs peephole optimisation including resynthesis of 2-qubit gate sequences, and converts to a circuit containing CX and TK1 gates. | |
PassPtr | FullPeepholeOptimise (bool allow_swaps=true, OpType target_2qb_gate=OpType::CX) |
Performs peephole optimisation including resynthesis of 2- and 3-qubit gate sequences, and converts to a circuit containing a given 2-qubit gate and TK1 gates. | |
PassPtr | gen_optimise_phase_gadgets (CXConfigType cx_config) |
PassPtr | gen_pairwise_pauli_gadgets (CXConfigType cx_config) |
PassPtr | gen_pauli_exponentials (Transforms::PauliSynthStrat strat, CXConfigType cx_config) |
PassPtr | gen_synthesise_pauli_graph (Transforms::PauliSynthStrat strat, CXConfigType cx_config) |
PassPtr | gen_greedy_pauli_simp (double discount_rate=0.7, double depth_weight=0.3, unsigned max_lookahead=500, unsigned max_tqe_candidates=500, unsigned seed=0, bool allow_zzphase=false, unsigned thread_timeout=100, bool only_reduce=false, unsigned trials=1) |
Greedy synthesis for Pauli graphs. | |
PassPtr | gen_special_UCC_synthesis (Transforms::PauliSynthStrat strat, CXConfigType cx_config) |
PassPtr | gen_simplify_initial (Transforms::AllowClassical allow_classical=Transforms::AllowClassical::Yes, Transforms::CreateAllQubits create_all_qubits=Transforms::CreateAllQubits::No, std::shared_ptr< const Circuit > xcirc=0) |
Generate a pass to simplify the circuit where it acts on known basis states. | |
PassPtr | gen_contextual_pass (Transforms::AllowClassical allow_classical=Transforms::AllowClassical::Yes, std::shared_ptr< const Circuit > xcirc=0) |
Generate a pass to perform simplifications dependent on qubit state. | |
PassPtr | PauliSquash (Transforms::PauliSynthStrat strat, CXConfigType cx_config) |
Builds a sequence of PauliSimp (gen_synthesise_pauli_graph) and FullPeepholeOptimise. | |
PassPtr | RoundAngles (unsigned n, bool only_zeros=false) |
Generate a pass that rounds all angles to the nearest \( \pi / 2^n \). | |
PassPtr | CustomPass (std::function< Circuit(const Circuit &)> transform, const std::string &label="") |
Generate a custom pass. | |
PassPtr | CustomPassMap (std::function< std::pair< Circuit, std::pair< unit_map_t, unit_map_t > >(const Circuit &)> transform, const std::string &label="") |
Generate a custom pass that tracks map. | |
const PassPtr & | SynthesiseTK () |
const PassPtr & | SynthesiseTket () |
const PassPtr & | RebaseTket () |
const PassPtr & | RebaseUFR () |
const PassPtr & | RemoveRedundancies () |
const PassPtr & | CommuteThroughMultis () |
const PassPtr & | DecomposeArbitrarilyControlledGates () |
const PassPtr & | DecomposeMultiQubitsCX () |
const PassPtr & | DecomposeSingleQubitsTK1 () |
PassPtr | ComposePhasePolyBoxes (unsigned min_size=0) |
converts a circuit containing all possible gates to a circuit containing only phase poly boxes + H gates (and measure + reset + collapse + barrier) | |
PassPtr | DecomposeBoxes (const std::unordered_set< OpType > &excluded_types={}, const std::unordered_set< std::string > &excluded_opgroups={}, const std::optional< std::unordered_set< OpType > > &included_types=std::nullopt, const std::optional< std::unordered_set< std::string > > &included_opgroups=std::nullopt) |
Recursively replaces all boxes by their decomposition using Box::to_circuit. | |
const PassPtr & | SquashTK1 () |
Squash sequences of single-qubit gates to TK1 gates. | |
const PassPtr & | DecomposeBridges () |
const PassPtr & | FlattenRegisters () |
const PassPtr & | RemoveBarriers () |
Remove all& OpType::Barrier from the circuit. | |
const PassPtr & | DelayMeasures (bool allow_partial=false) |
Commutes measurements to the end of the circuit. | |
const PassPtr & | RemoveDiscarded () |
Remove all operations that have no OpType::Output or OpType::ClOutput in their causal future. | |
const PassPtr & | SimplifyMeasured () |
Replace all measured classical maps that are followed by Measure operations whose quantum output is discarded with classical operations following the Measure. | |
const PassPtr & | NormaliseTK2 () |
Normalises all TK2 gates. | |
const PassPtr & | ZZPhaseToRz () |
Converts ZZPhase with angle 1 or -1 to two Rz(1) gates. | |
const PassPtr & | SquashRzPhasedX () |
Squash single qubit gates into PhasedX and Rz gates. | |
const PassPtr & | CnXPairwiseDecomposition () |
Decompose CnX gates to 2-qubit gates and single qubit gates. | |
const PassPtr & | RemoveImplicitQubitPermutation () |
Remove any implicit qubit permutation by appending SWAP gates. | |
const PassPtr & | ZXGraphlikeOptimisation (bool allow_swaps=true) |
Attempt to optimise the circuit by simplifying in ZX calculus and extracting a circuit back out. | |
const PassPtr & | RemovePhaseOps () |
Remove all OpType::Phase (including conditionals) from the circuit. | |
const std::string & | predicate_name (std::type_index idx) |
void | to_json (nlohmann::json &j, const PredicatePtr &pred_ptr) |
void | from_json (const nlohmann::json &j, PredicatePtr &pred_ptr) |
Transform | operator>> (const Transform &lhs, const Transform &rhs) |
Circuit | multi_controlled_to_2q (const Op_ptr op, const std::optional< OpType > &two_q_type=std::nullopt) |
Replace CnRy, CnRx, CnRz, CnX, CnZ, CnY with 2-qubit gates and single qubit gates. | |
Circuit | TK2_circ_from_multiq (const Op_ptr op) |
Replace a multi-qubit operation with an equivalent circuit using TK2 gates. | |
Circuit | CX_circ_from_multiq (const Op_ptr op) |
Replace a multi-qubit operation with an equivalent circuit using CX gates. | |
Circuit | CX_ZX_circ_from_op (const Op_ptr op) |
Replace an operation with an equivalent circuit using CX, Rx and Rz. | |
csd_t | CS_decomp (const Eigen::MatrixXcd &u) |
Compute a cosine-sine decomposition of a unitary matrix. | |
bool | approx_0 (const Expr &e, double tol=EPS) |
Test if an expression is approximately zero. | |
double | fmodn (double x, unsigned n) |
Evaluate modulo n in the range [0,n) | |
bool | approx_eq (double x, double y, unsigned mod=2, double tol=EPS) |
Test approximate equality of two values modulo n. | |
SymSet | expr_free_symbols (const Expr &e) |
Set of all free symbols contained in the expression. | |
SymSet | expr_free_symbols (const std::vector< Expr > &es) |
Set of all free symbols contained in the expressions in the vector. | |
std::optional< double > | eval_expr (const Expr &e) |
std::optional< Complex > | eval_expr_c (const Expr &e) |
std::optional< double > | eval_expr_mod (const Expr &e, unsigned n=2) |
Evaluate an expression modulo n. | |
Expr | cos_halfpi_times (const Expr &e) |
Return cos(e*pi/2) | |
Expr | sin_halfpi_times (const Expr &e) |
Return sin(e*pi/2) | |
Expr | minus_times (const Expr &e) |
Return -e. | |
bool | equiv_expr (const Expr &e0, const Expr &e1, unsigned n=2, double tol=EPS) |
Test approximate equality of expressions modulo n. | |
bool | equiv_val (const Expr &e, double x, unsigned n=2, double tol=EPS) |
Test approximate value of an expression modulo n. | |
bool | equiv_0 (const Expr &e, unsigned n=2, double tol=EPS) |
Test whether a expression is approximately 0 modulo n. | |
std::optional< unsigned > | equiv_Clifford (const Expr &e, unsigned n=2, double tol=EPS) |
Test whether an expression is approximately a Clifford angle (some multiple of 0.5 modulo n) | |
GrayCode | gen_graycode (unsigned n) |
Construct a GrayCode over n bits. | |
uint64_t | reverse_bits (uint64_t v, unsigned w) |
Reverse bits 0,1,...,w-1 of the number v, assuming v < 2^w and w <= 64. | |
std::vector< bool > | dec_to_bin (unsigned long long dec, unsigned width) |
convert an unsigned to its binary representation big-endian | |
unsigned long long | bin_to_dec (const std::vector< bool > &bin) |
convert an bit vector to its decimal representation big-endian | |
bool | is_unitary (const Eigen::MatrixXcd &U, double tol=EPS) |
Test matrix for unitarity. | |
bool | is_projector (const Eigen::MatrixXcd &P, double tol) |
std::pair< MatrixXb, MatrixXb > | binary_LLT_decomposition (const MatrixXb &a) |
std::vector< std::pair< unsigned, unsigned > > | gaussian_elimination_col_ops (const MatrixXb &a, unsigned blocksize) |
std::vector< std::pair< unsigned, unsigned > > | gaussian_elimination_row_ops (const MatrixXb &a, unsigned blocksize) |
Eigen::PermutationMatrix< Eigen::Dynamic > | lift_perm (const std::map< unsigned, unsigned > &p) |
Lift a permutation of \( [0,n) \) to a permutation of \( [0,2^n) \) as a matrix. | |
Eigen::Matrix4cd | reverse_indexing (const Eigen::Matrix4cd &m) |
Matrix8cd | reverse_indexing (const Matrix8cd &m) |
Eigen::MatrixXcd | reverse_indexing (const Eigen::MatrixXcd &m) |
Eigen::VectorXcd | reverse_indexing (const Eigen::VectorXcd &v) |
Eigen::MatrixXcd | apply_qubit_permutation (const Eigen::MatrixXcd &m, const qubit_map_t &perm) |
Eigen::VectorXcd | apply_qubit_permutation (const Eigen::VectorXcd &v, const qubit_map_t &perm) |
double | trace_fidelity (double a, double b, double c) |
Similarity measure of TK2(a, b, c) to SU(4) identity. | |
double | mod (double d, double max) |
std::tuple< Eigen::Matrix4cd, std::array< double, 3 >, Eigen::Matrix4cd > | get_information_content (const Eigen::Matrix4cd &X) |
Performs KAK decomposition. | |
std::pair< Eigen::Matrix2cd, Eigen::Matrix2cd > | kronecker_decomposition (Eigen::Matrix4cd &U) |
unsigned | get_matrix_size (unsigned number_of_qubits) |
Returns 2^n, but throws if n is too large (causes overflow). | |
unsigned | get_number_of_qubits (unsigned matrix_size) |
We have a matrix size, which should be 2^n. | |
SparseMatrixXcd | get_sparse_matrix (const std::vector< TripletCd > &triplets, unsigned rows, unsigned cols) |
SparseMatrixXcd | get_sparse_square_matrix (const std::vector< TripletCd > &triplets, unsigned rows) |
std::vector< TripletCd > | get_triplets (const SparseMatrixXcd &matr, double abs_epsilon=EPS) |
abs_epsilon is used to decide if a near-zero entry should be set to zero exactly. | |
std::vector< TripletCd > | get_triplets (const Eigen::MatrixXcd &matr, double abs_epsilon=EPS) |
Convert a matrix M into a list of tuples (i,j,z), meaning that M(i,j)=z, used in sparse representations of M. | |
bool | in_weyl_chamber (const std::array< Expr, 3 > &k) |
Whether a triplet of TK2 angles are normalised. | |
Eigen::Matrix2cd | nth_root (const Eigen::Matrix2cd &u, unsigned long long n) |
Get an nth root of a 2x2 unitary matrix. | |
void | to_json (nlohmann::json &, const no_coeff_t &) |
void | from_json (const nlohmann::json &, no_coeff_t &) |
template<> | |
no_coeff_t | default_coeff< no_coeff_t > () |
template<> | |
quarter_turns_t | default_coeff< quarter_turns_t > () |
template<> | |
Complex | default_coeff< Complex > () |
template<> | |
Expr | default_coeff< Expr > () |
template<> | |
QubitPauliMap | cast_container< QubitPauliMap, QubitPauliMap > (const QubitPauliMap &cont) |
template<> | |
QubitPauliMap | cast_container< DensePauliMap, QubitPauliMap > (const DensePauliMap &cont) |
template<> | |
DensePauliMap | cast_container< QubitPauliMap, DensePauliMap > (const QubitPauliMap &cont) |
template<> | |
DensePauliMap | cast_container< DensePauliMap, DensePauliMap > (const DensePauliMap &cont) |
template<> | |
no_coeff_t | cast_coeff< no_coeff_t, no_coeff_t > (const no_coeff_t &) |
template<> | |
quarter_turns_t | cast_coeff< no_coeff_t, quarter_turns_t > (const no_coeff_t &) |
template<> | |
Complex | cast_coeff< no_coeff_t, Complex > (const no_coeff_t &) |
template<> | |
Expr | cast_coeff< no_coeff_t, Expr > (const no_coeff_t &) |
template<> | |
no_coeff_t | cast_coeff< quarter_turns_t, no_coeff_t > (const quarter_turns_t &) |
template<> | |
quarter_turns_t | cast_coeff< quarter_turns_t, quarter_turns_t > (const quarter_turns_t &coeff) |
template<> | |
Complex | cast_coeff< quarter_turns_t, Complex > (const quarter_turns_t &coeff) |
template<> | |
Expr | cast_coeff< quarter_turns_t, Expr > (const quarter_turns_t &coeff) |
template<> | |
no_coeff_t | cast_coeff< Complex, no_coeff_t > (const Complex &) |
template<> | |
quarter_turns_t | cast_coeff< Complex, quarter_turns_t > (const Complex &coeff) |
template<> | |
Complex | cast_coeff< Complex, Complex > (const Complex &coeff) |
template<> | |
Expr | cast_coeff< Complex, Expr > (const Complex &coeff) |
template<> | |
no_coeff_t | cast_coeff< Expr, no_coeff_t > (const Expr &) |
template<> | |
quarter_turns_t | cast_coeff< Expr, quarter_turns_t > (const Expr &coeff) |
template<> | |
Complex | cast_coeff< Expr, Complex > (const Expr &coeff) |
template<> | |
Expr | cast_coeff< Expr, Expr > (const Expr &coeff) |
template<> | |
int | compare_containers< QubitPauliMap > (const QubitPauliMap &first, const QubitPauliMap &second) |
template<> | |
int | compare_containers< DensePauliMap > (const DensePauliMap &first, const DensePauliMap &second) |
template<> | |
int | compare_coeffs< no_coeff_t > (const no_coeff_t &, const no_coeff_t &) |
template<> | |
int | compare_coeffs< quarter_turns_t > (const quarter_turns_t &first, const quarter_turns_t &second) |
template<> | |
int | compare_coeffs< Complex > (const Complex &first, const Complex &second) |
template<> | |
int | compare_coeffs< Expr > (const Expr &first, const Expr &second) |
std::set< Qubit > | common_qubits (const QubitPauliMap &first, const QubitPauliMap &second) |
Find the set of Qubits on which first and second have the same non-trivial Pauli (X, Y, Z). | |
std::set< unsigned > | common_indices (const DensePauliMap &first, const DensePauliMap &second) |
Find the set of qubits (as unsigned integer indices) on which first and second have the same non-trivial Pauli (X, Y, Z). | |
std::set< Qubit > | own_qubits (const QubitPauliMap &first, const QubitPauliMap &second) |
Find the set of Qubits on which first has a non-trivial Pauli (X, Y, Z) but second either doesn't contain or maps to I. | |
std::set< unsigned > | own_indices (const DensePauliMap &first, const DensePauliMap &second) |
Find the set of qubits (as unsigned integer indices) on which first has a non-trivial Pauli (X, Y, Z) but second either doesn't contain (>= size) or maps to I. | |
std::set< Qubit > | conflicting_qubits (const QubitPauliMap &first, const QubitPauliMap &second) |
Find the set of Qubits on which first and second have distinct non-trivial Paulis (X, Y, Z). | |
std::set< unsigned > | conflicting_indices (const DensePauliMap &first, const DensePauliMap &second) |
Find the set of qubits (as unsigned integer indices) on which first and second have distinct non-trivial Paulis (X, Y, Z). | |
template<> | |
bool | commuting_containers< QubitPauliMap > (const QubitPauliMap &first, const QubitPauliMap &second) |
template<> | |
bool | commuting_containers< DensePauliMap > (const DensePauliMap &first, const DensePauliMap &second) |
template<> | |
void | print_paulis< QubitPauliMap > (std::ostream &os, const QubitPauliMap &paulis) |
template<> | |
void | print_paulis< DensePauliMap > (std::ostream &os, const DensePauliMap &paulis) |
template<> | |
void | print_coeff< no_coeff_t > (std::ostream &, const no_coeff_t &) |
Generates the coefficient prefix for PauliTensor::to_str() | |
template<> | |
void | print_coeff< quarter_turns_t > (std::ostream &os, const quarter_turns_t &coeff) |
template<> | |
void | print_coeff< Complex > (std::ostream &os, const Complex &coeff) |
template<> | |
void | print_coeff< Expr > (std::ostream &os, const Expr &coeff) |
template<> | |
void | hash_combine_paulis< QubitPauliMap > (std::size_t &seed, const QubitPauliMap &paulis) |
template<> | |
void | hash_combine_paulis< DensePauliMap > (std::size_t &seed, const DensePauliMap &paulis) |
template<> | |
void | hash_combine_coeff< no_coeff_t > (std::size_t &, const no_coeff_t &) |
template<> | |
void | hash_combine_coeff< quarter_turns_t > (std::size_t &seed, const quarter_turns_t &coeff) |
template<> | |
void | hash_combine_coeff< Complex > (std::size_t &seed, const Complex &coeff) |
template<> | |
void | hash_combine_coeff< Expr > (std::size_t &seed, const Expr &coeff) |
template<> | |
unsigned | n_ys< QubitPauliMap > (const QubitPauliMap &paulis) |
template<> | |
unsigned | n_ys< DensePauliMap > (const DensePauliMap &paulis) |
const std::map< std::pair< Pauli, Pauli >, std::pair< quarter_turns_t, Pauli > > & | get_mult_matrix () |
Returns a const reference to a lookup table for multiplying individual Paulis. | |
template<> | |
std::pair< quarter_turns_t, QubitPauliMap > | multiply_strings< QubitPauliMap > (const QubitPauliMap &first, const QubitPauliMap &second) |
template<> | |
std::pair< quarter_turns_t, DensePauliMap > | multiply_strings< DensePauliMap > (const DensePauliMap &first, const DensePauliMap &second) |
template<> | |
no_coeff_t | multiply_coeffs< no_coeff_t > (const no_coeff_t &, const no_coeff_t &) |
template<> | |
quarter_turns_t | multiply_coeffs< quarter_turns_t > (const quarter_turns_t &first, const quarter_turns_t &second) |
template<> | |
Complex | multiply_coeffs< Complex > (const Complex &first, const Complex &second) |
template<> | |
Expr | multiply_coeffs< Expr > (const Expr &first, const Expr &second) |
template<> | |
CmplxSpMat | to_sparse_matrix< QubitPauliMap > (const QubitPauliMap &paulis) |
template<> | |
CmplxSpMat | to_sparse_matrix< DensePauliMap > (const DensePauliMap &paulis) |
template<> | |
CmplxSpMat | to_sparse_matrix< QubitPauliMap > (const QubitPauliMap &paulis, unsigned n_qubits) |
template<> | |
CmplxSpMat | to_sparse_matrix< DensePauliMap > (const DensePauliMap &paulis, unsigned n_qubits) |
template<> | |
CmplxSpMat | to_sparse_matrix< QubitPauliMap > (const QubitPauliMap &paulis, const qubit_vector_t &qubits) |
template<> | |
CmplxSpMat | to_sparse_matrix< DensePauliMap > (const DensePauliMap &paulis, const qubit_vector_t &qubits) |
void | to_json (nlohmann::json &j, const Qubit &qb) |
void | from_json (const nlohmann::json &j, Qubit &qb) |
void | to_json (nlohmann::json &j, const Bit &cb) |
void | from_json (const nlohmann::json &j, Bit &cb) |
void | to_json (nlohmann::json &j, const WasmState &wb) |
void | from_json (const nlohmann::json &j, WasmState &wb) |
void | to_json (nlohmann::json &j, const Node &node) |
void | from_json (const nlohmann::json &j, Node &node) |
void | to_json (nlohmann::json &j, const qubit_map_t &qm) |
void | from_json (const nlohmann::json &j, qubit_map_t &qm) |
const std::string & | q_default_reg () |
const std::string & | q_routing_ancilla_reg () |
const std::string & | c_default_reg () |
const std::string & | w_default_reg () |
const std::string & | node_default_reg () |
const std::string & | c_debug_zero_prefix () |
const std::string & | c_debug_one_prefix () |
const std::string & | c_debug_default_name () |
const std::string & | c_permutation_scratch_name () |
int | tri_lexicographical_comparison (const dist_vec &dist1, const dist_vec &dist2) |
template<typename BoxT > | |
Op_ptr | set_box_id (BoxT &b, boost::uuids::uuid newid) |
Set explicit ID on a box. | |
template<arithmetic T> | |
void | to_json (nlohmann::json &j, const ResourceBounds< T > &bounds) |
template<arithmetic T> | |
void | from_json (const nlohmann::json &j, ResourceBounds< T > &bounds) |
NLOHMANN_JSON_SERIALIZE_ENUM (ToffoliBoxSynthStrat, {{ToffoliBoxSynthStrat::Matching, "Matching"}, {ToffoliBoxSynthStrat::Cycle, "Cycle"}}) | |
JSON_DECL (LexiRouteRoutingMethod) | |
JSON_DECL (RoutingMethod) | |
JSON_DECL (std::vector< RoutingMethodPtr >) | |
NLOHMANN_JSON_SERIALIZE_ENUM (ClOp, { {ClOp::INVALID, "INVALID"}, {ClOp::BitAnd, "BitAnd"}, {ClOp::BitOr, "BitOr"}, {ClOp::BitXor, "BitXor"}, {ClOp::BitEq, "BitEq"}, {ClOp::BitNeq, "BitNeq"}, {ClOp::BitNot, "BitNot"}, {ClOp::BitZero, "BitZero"}, {ClOp::BitOne, "BitOne"}, {ClOp::RegAnd, "RegAnd"}, {ClOp::RegOr, "RegOr"}, {ClOp::RegXor, "RegXor"}, {ClOp::RegEq, "RegEq"}, {ClOp::RegNeq, "RegNeq"}, {ClOp::RegNot, "RegNot"}, {ClOp::RegZero, "RegZero"}, {ClOp::RegOne, "RegOne"}, {ClOp::RegLt, "RegLt"}, {ClOp::RegGt, "RegGt"}, {ClOp::RegLeq, "RegLeq"}, {ClOp::RegGeq, "RegGeq"}, {ClOp::RegAdd, "RegAdd"}, {ClOp::RegSub, "RegSub"}, {ClOp::RegMul, "RegMul"}, {ClOp::RegDiv, "RegDiv"}, {ClOp::RegPow, "RegPow"}, {ClOp::RegLsh, "RegLsh"}, {ClOp::RegRsh, "RegRsh"}, {ClOp::RegNeg, "RegNeg"}, }) typedef struct ClBitVar | |
A bit variable within an expression. | |
NLOHMANN_JSON_SERIALIZE_ENUM (EdgeType, { {EdgeType::Quantum, "Q"}, {EdgeType::Classical, "C"}, {EdgeType::Boolean, "B"}, {EdgeType::WASM, "W"}, }) | |
JSON_DECL (Placement::Ptr) | |
std::vector< boost::bimap< Qubit, Node > > | get_weighted_subgraph_monomorphisms (QubitGraph::UndirectedConnGraph &pattern_graph, Architecture::UndirectedConnGraph &target_graph, unsigned max_matches, unsigned timeout_ms, bool return_best) |
Solves the pure unweighted subgraph monomorphism problem, trying to embed the pattern graph into the target graph. | |
constexpr Complex | i_ (0, 1) |
A fixed square root of -1. | |
constexpr Complex | czero (0, 0) |
Complex zero. | |
template<typename T > | |
bool | check_iterators_equality (const T &first, const T &second) |
Check equality of each element of first and second when first and second can provide begin, end iterators. | |
template<class MatrixT > | |
MatrixT | unitary_product2 (const MatrixT &U, const MatrixT &V) |
Compute the product of two unitary matrices, with error correction. | |
template<class MatrixT > | |
MatrixT | unitary_product3 (const MatrixT &U, const MatrixT &V, const MatrixT &W) |
Compute the product of three unitary matrices, with error correction. | |
NLOHMANN_JSON_SERIALIZE_ENUM (Pauli, { {Pauli::I, "I"}, {Pauli::X, "X"}, {Pauli::Y, "Y"}, {Pauli::Z, "Z"}, }) | |
NLOHMANN_JSON_SERIALIZE_ENUM (CXConfigType, {{CXConfigType::Snake, "Snake"}, {CXConfigType::Tree, "Tree"}, {CXConfigType::Star, "Star"}, {CXConfigType::MultiQGate, "MultiQGate"}}) | |
template<typename CoeffType > | |
CoeffType | default_coeff ()=delete |
Other options for scalar coefficients include: | |
template<> | |
no_coeff_t | default_coeff< no_coeff_t > () |
template<> | |
quarter_turns_t | default_coeff< quarter_turns_t > () |
template<> | |
Complex | default_coeff< Complex > () |
template<> | |
Expr | default_coeff< Expr > () |
template<typename OriginalCoeff , typename NewCoeff > | |
NewCoeff | cast_coeff (const OriginalCoeff &coeff)=delete |
Cast a coefficient to a different type. | |
template<> | |
no_coeff_t | cast_coeff< no_coeff_t, no_coeff_t > (const no_coeff_t &) |
template<> | |
quarter_turns_t | cast_coeff< no_coeff_t, quarter_turns_t > (const no_coeff_t &) |
template<> | |
Complex | cast_coeff< no_coeff_t, Complex > (const no_coeff_t &) |
template<> | |
Expr | cast_coeff< no_coeff_t, Expr > (const no_coeff_t &) |
template<> | |
no_coeff_t | cast_coeff< quarter_turns_t, no_coeff_t > (const quarter_turns_t &) |
template<> | |
quarter_turns_t | cast_coeff< quarter_turns_t, quarter_turns_t > (const quarter_turns_t &coeff) |
template<> | |
Complex | cast_coeff< quarter_turns_t, Complex > (const quarter_turns_t &coeff) |
template<> | |
Expr | cast_coeff< quarter_turns_t, Expr > (const quarter_turns_t &coeff) |
template<> | |
no_coeff_t | cast_coeff< Complex, no_coeff_t > (const Complex &) |
template<> | |
quarter_turns_t | cast_coeff< Complex, quarter_turns_t > (const Complex &coeff) |
template<> | |
Complex | cast_coeff< Complex, Complex > (const Complex &coeff) |
template<> | |
Expr | cast_coeff< Complex, Expr > (const Complex &coeff) |
template<> | |
no_coeff_t | cast_coeff< Expr, no_coeff_t > (const Expr &) |
template<> | |
quarter_turns_t | cast_coeff< Expr, quarter_turns_t > (const Expr &coeff) |
template<> | |
Complex | cast_coeff< Expr, Complex > (const Expr &coeff) |
template<> | |
Expr | cast_coeff< Expr, Expr > (const Expr &coeff) |
template<typename CoeffType > | |
int | compare_coeffs (const CoeffType &first, const CoeffType &second)=delete |
Compare two coefficients of the same type with respect to an ordering. | |
template<> | |
int | compare_coeffs< no_coeff_t > (const no_coeff_t &, const no_coeff_t &) |
template<> | |
int | compare_coeffs< quarter_turns_t > (const quarter_turns_t &first, const quarter_turns_t &second) |
template<> | |
int | compare_coeffs< Complex > (const Complex &first, const Complex &second) |
template<> | |
int | compare_coeffs< Expr > (const Expr &first, const Expr &second) |
template<typename CoeffType > | |
void | print_coeff (std::ostream &os, const CoeffType &coeff)=delete |
template<> | |
void | print_coeff< no_coeff_t > (std::ostream &, const no_coeff_t &) |
Generates the coefficient prefix for PauliTensor::to_str() | |
template<> | |
void | print_coeff< quarter_turns_t > (std::ostream &os, const quarter_turns_t &coeff) |
template<> | |
void | print_coeff< Complex > (std::ostream &os, const Complex &coeff) |
template<> | |
void | print_coeff< Expr > (std::ostream &os, const Expr &coeff) |
template<typename CoeffType > | |
void | hash_combine_coeff (std::size_t &seed, const CoeffType &coeff)=delete |
Hash a coefficient, combining it with an existing hash of another structure. | |
template<> | |
void | hash_combine_coeff< no_coeff_t > (std::size_t &, const no_coeff_t &) |
template<> | |
void | hash_combine_coeff< quarter_turns_t > (std::size_t &seed, const quarter_turns_t &coeff) |
template<> | |
void | hash_combine_coeff< Complex > (std::size_t &seed, const Complex &coeff) |
template<> | |
void | hash_combine_coeff< Expr > (std::size_t &seed, const Expr &coeff) |
template<typename CoeffType > | |
CoeffType | multiply_coeffs (const CoeffType &first, const CoeffType &second)=delete |
Multiply together two coefficients of the same type. | |
template<> | |
no_coeff_t | multiply_coeffs< no_coeff_t > (const no_coeff_t &, const no_coeff_t &) |
template<> | |
quarter_turns_t | multiply_coeffs< quarter_turns_t > (const quarter_turns_t &first, const quarter_turns_t &second) |
template<> | |
Complex | multiply_coeffs< Complex > (const Complex &first, const Complex &second) |
template<> | |
Expr | multiply_coeffs< Expr > (const Expr &first, const Expr &second) |
template<typename OriginalContainer , typename NewContainer > | |
NewContainer | cast_container (const OriginalContainer &cont)=delete |
Cast between two different Pauli container types. | |
template<> | |
QubitPauliMap | cast_container< QubitPauliMap, QubitPauliMap > (const QubitPauliMap &cont) |
template<> | |
QubitPauliMap | cast_container< DensePauliMap, QubitPauliMap > (const DensePauliMap &cont) |
template<> | |
DensePauliMap | cast_container< QubitPauliMap, DensePauliMap > (const QubitPauliMap &cont) |
template<> | |
DensePauliMap | cast_container< DensePauliMap, DensePauliMap > (const DensePauliMap &cont) |
template<typename PauliContainer > | |
int | compare_containers (const PauliContainer &first, const PauliContainer &second)=delete |
Compare two Pauli containers of the same type for ordering. | |
template<> | |
int | compare_containers< QubitPauliMap > (const QubitPauliMap &first, const QubitPauliMap &second) |
template<> | |
int | compare_containers< DensePauliMap > (const DensePauliMap &first, const DensePauliMap &second) |
template<typename PauliContainer > | |
bool | commuting_containers (const PauliContainer &first, const PauliContainer &second)=delete |
Return whether two Pauli containers commute as Pauli strings (there are an even number of qubits on which they have distinct non-trivial Paulis). | |
template<> | |
bool | commuting_containers< QubitPauliMap > (const QubitPauliMap &first, const QubitPauliMap &second) |
template<> | |
bool | commuting_containers< DensePauliMap > (const DensePauliMap &first, const DensePauliMap &second) |
template<typename PauliContainer > | |
void | print_paulis (std::ostream &os, const PauliContainer &paulis)=delete |
Generates the readable Pauli string portion of PauliTensor::to_str(). | |
template<> | |
void | print_paulis< QubitPauliMap > (std::ostream &os, const QubitPauliMap &paulis) |
template<> | |
void | print_paulis< DensePauliMap > (std::ostream &os, const DensePauliMap &paulis) |
template<typename PauliContainer > | |
void | hash_combine_paulis (std::size_t &seed, const PauliContainer &paulis)=delete |
Hash a Pauli container, combining it with an existing hash of another structure. | |
template<> | |
void | hash_combine_paulis< QubitPauliMap > (std::size_t &seed, const QubitPauliMap &paulis) |
template<> | |
void | hash_combine_paulis< DensePauliMap > (std::size_t &seed, const DensePauliMap &paulis) |
template<typename PauliContainer > | |
unsigned | n_ys (const PauliContainer &paulis)=delete |
Return the number of Pauli::Ys in the container. | |
template<> | |
unsigned | n_ys< QubitPauliMap > (const QubitPauliMap &paulis) |
template<> | |
unsigned | n_ys< DensePauliMap > (const DensePauliMap &paulis) |
template<typename PauliContainer > | |
std::pair< quarter_turns_t, PauliContainer > | multiply_strings (const PauliContainer &first, const PauliContainer &second)=delete |
Multiplies two Pauli containers component-wise, returning both the resulting phase and string. | |
template<> | |
std::pair< quarter_turns_t, QubitPauliMap > | multiply_strings< QubitPauliMap > (const QubitPauliMap &first, const QubitPauliMap &second) |
template<> | |
std::pair< quarter_turns_t, DensePauliMap > | multiply_strings< DensePauliMap > (const DensePauliMap &first, const DensePauliMap &second) |
template<typename PauliContainer > | |
CmplxSpMat | to_sparse_matrix (const PauliContainer &paulis)=delete |
Evaluates a Pauli container to a sparse matrix describing the tensor product of each Pauli in the string. | |
template<> | |
CmplxSpMat | to_sparse_matrix< QubitPauliMap > (const QubitPauliMap &paulis) |
template<> | |
CmplxSpMat | to_sparse_matrix< DensePauliMap > (const DensePauliMap &paulis) |
template<typename PauliContainer > | |
CmplxSpMat | to_sparse_matrix (const PauliContainer &paulis, unsigned n_qubits)=delete |
Evaluates a Pauli container to a sparse matrix describing the tensor product of each Pauli in the string. | |
template<> | |
CmplxSpMat | to_sparse_matrix< QubitPauliMap > (const QubitPauliMap &paulis, unsigned n_qubits) |
template<> | |
CmplxSpMat | to_sparse_matrix< DensePauliMap > (const DensePauliMap &paulis, unsigned n_qubits) |
template<typename PauliContainer > | |
CmplxSpMat | to_sparse_matrix (const PauliContainer &paulis, const qubit_vector_t &qubits)=delete |
Evaluates a Pauli container to a sparse matrix describing the tensor product of each Pauli in the string. | |
template<> | |
CmplxSpMat | to_sparse_matrix< QubitPauliMap > (const QubitPauliMap &paulis, const qubit_vector_t &qubits) |
template<> | |
CmplxSpMat | to_sparse_matrix< DensePauliMap > (const DensePauliMap &paulis, const qubit_vector_t &qubits) |
template<typename PauliContainer , typename CoeffType > | |
void | to_json (nlohmann::json &j, const PauliTensor< PauliContainer, CoeffType > &tensor) |
template<typename PauliContainer , typename CoeffType > | |
void | from_json (const nlohmann::json &j, PauliTensor< PauliContainer, CoeffType > &tensor) |
template<class Unit_T > | |
void | unitid_to_json (nlohmann::json &j, const Unit_T &unit) |
template<class T > | |
void | json_to_unitid (const nlohmann::json &j, T &unit) |
template<typename UnitA , typename UnitB > | |
bool | update_maps (std::shared_ptr< unit_bimaps_t > maps, const std::map< UnitA, UnitB > &um_initial, const std::map< UnitA, UnitB > &um_final) |
Update a pair of "initial" and "final" correspondences. | |
Variables | |
ClBitVar | |
const OptUInt | any = std::nullopt |
Unspecified unsigned integer. | |
constexpr double | EPS = 1e-11 |
Default tolerance for floating-point comparisons. | |
constexpr double | PI |
\( \pi \) | |
Defines tket::DeviceCharacterisation, used in NoiseAwarePlacement and in commute_SQ_gates_through_SWAPS as a simple device noise model.
This header contains the implementation-specific type definitions for the ZXDiagram class.
This is just a container of errors.
This supports single-qubit errors, two-qubit errors and readout errors. Errors can either be OpType-specific, or a default value (average over all possible OpTypes) If an OpType-specific value is provided, this will be used. If not it will fallback to the default value for the given Node or Node pair, which itself falls back to zero error.
Currently, Boost is used for the underlying graph structure. The interface can be found in ZXDiagram.hpp.
A ZX diagram is implemented as a directed graph with labels for its vertices and edges. Although edges in a ZX diagram are ultimately undirected, some vertices are directed or otherwise non-commutative. That is, the permutation in which the edges are connected to the vertex matters, either to distinguish between inputs and outputs of the vertex or operands with different semantics. We refer to such vertices as "directed".
To represent these diagrams with undirected edges but some directed vertices we use a directed underlying graph.
ZXGen_ptr
object (equivalent to Op_ptr
from circuits) containing the relevant information. In ZX diagrams, the ZXGenerator
object pointed to is guaranteed to be exactly one subtype based on its ZXType
.DirectedZXGenerator
object which captures the information about the ports. The mapping of ports to semantic meaning is dictated by the particular ZXType
. In general, ports are optional unsigned integers, taking values for directed vertices and std::nullopt
for undirected.typedef std::shared_ptr<Architecture> tket::ArchitecturePtr |
Definition at line 211 of file Architecture.hpp.
typedef std::map<std::pair<Node, Node>, gate_error_t> tket::avg_link_errors_t |
Definition at line 30 of file ErrorTypes.hpp.
typedef std::map<Node, gate_error_t> tket::avg_node_errors_t |
Definition at line 28 of file ErrorTypes.hpp.
typedef std::map<Node, readout_error_t> tket::avg_readout_errors_t |
Definition at line 29 of file ErrorTypes.hpp.
typedef sequenced_map_t<Bit, EdgeVec> tket::b_frontier_t |
Definition at line 28 of file Slices.hpp.
using tket::BimapValue = typedef boost::bimap<Qubit, Node>::value_type |
Definition at line 28 of file MonomorphismCalculation.cpp.
typedef std::map<Bit, Bit> tket::bit_map_t |
Definition at line 320 of file UnitID.hpp.
typedef std::vector<Bit> tket::bit_vector_t |
Definition at line 319 of file UnitID.hpp.
typedef boost::multi_index::multi_index_container< BoundaryElement, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag<TagID>, boost::multi_index::member< BoundaryElement, UnitID, &BoundaryElement::id_> >, boost::multi_index::ordered_unique< boost::multi_index::tag<TagIn>, boost::multi_index::member< BoundaryElement, Vertex, &BoundaryElement::in_> >, boost::multi_index::ordered_unique< boost::multi_index::tag<TagOut>, boost::multi_index::member< BoundaryElement, Vertex, &BoundaryElement::out_> >, boost::multi_index::ordered_non_unique< boost::multi_index::tag<TagType>, boost::multi_index::const_mem_fun< BoundaryElement, UnitType, &BoundaryElement::type> >, boost::multi_index::ordered_non_unique< boost::multi_index::tag<TagReg>, boost::multi_index::const_mem_fun< BoundaryElement, std::string, &BoundaryElement::reg_name> > > > tket::boundary_t |
Definition at line 109 of file Circuit.hpp.
typedef boost::bimap<ZXVert, Vertex> tket::BoundaryVertMap |
Definition at line 27 of file ZXConverters.cpp.
typedef std::vector<EdgeVec> tket::BundleVec |
Definition at line 57 of file Circuit.hpp.
typedef std::variant<ClExprTerm, ClExpr> tket::ClExprArg |
An argument to a classical operation in an expression.
Definition at line 141 of file ClExpr.hpp.
typedef std::variant<uint64_t, ClExprVar> tket::ClExprTerm |
A term in a classical expression (either a constant or a variable)
Definition at line 128 of file ClExpr.hpp.
typedef std::variant<ClBitVar, ClRegVar> tket::ClExprVar |
A (bit or register) variable within an expression.
Definition at line 117 of file ClExpr.hpp.
typedef struct tket::ClRegVar tket::ClRegVar |
A register variable within an expression.
typedef Eigen::SparseMatrix<Complex, Eigen::ColMajor> tket::CmplxSpMat |
Definition at line 49 of file PauliTensor.hpp.
typedef std::complex<double> tket::Complex |
Complex number.
Definition at line 29 of file Constants.hpp.
typedef std::shared_ptr<CompositeGateDef> tket::composite_def_ptr_t |
typedef std::list<std::pair<OpType, qubit_vector_t> > tket::Conjugations |
Definition at line 51 of file PauliGraph.hpp.
typedef std::tuple< Eigen::MatrixXcd, Eigen::MatrixXcd, Eigen::MatrixXcd, Eigen::MatrixXcd, Eigen::MatrixXd, Eigen::MatrixXd> tket::csd_t |
Cosine-sine decomposition.
The tuple (l0, l1, r0, r1, c, s) represents the decomposition [l0 ] [c -s] [r0 ] [ l1] [s c] [ r1] where l0, l1, r0 and r1 are unitaries of equal size, c and s are diagonal matrices with non-negative entries, the diagonal entries of c are in non-decreasimg order, and c^2 + s^2 = I
Definition at line 35 of file CosSinDecomposition.hpp.
typedef std::map<std::vector<bool>, Op_ptr> tket::ctrl_op_map_t |
Map bitstrings to Ops.
Definition at line 25 of file Multiplexor.hpp.
typedef std::map<std::vector<bool>, std::vector<Op_ptr> > tket::ctrl_tensored_op_map_t |
Map bitstrings to tensored Ops.
Definition at line 31 of file Multiplexor.hpp.
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS> tket::cube_graph_t |
Definition at line 117 of file ToffoliBox.cpp.
typedef PauliTensor<DensePauliMap, Complex> tket::CxPauliTensor |
Definition at line 1045 of file PauliTensor.hpp.
typedef std::vector<std::vector<bool> > tket::cycle_permutation_t |
Definition at line 388 of file ToffoliBox.cpp.
typedef std::vector<transposition_t> tket::cycle_transposition_t |
Definition at line 389 of file ToffoliBox.cpp.
typedef boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, boost::property<boost::vertex_index_t, std::size_t, VertexProperties>, EdgeProperties> tket::DAG |
Graph representing a circuit, with operations as nodes.
Definition at line 68 of file DAGDefs.hpp.
typedef std::vector<Pauli> tket::DensePauliMap |
A dense, unsigned-indexed Pauli container.
A DensePauliMap is generally treated the same regardless of any Pauli::Is padded at the end. Each qubit index is treated as the corresponding Qubit id from the default register.
In future work, it may be interesting to consider a symplectic representation (representing each Pauli by a pair of bits representing X and Z) for both speed and memory efficiency.
Definition at line 267 of file PauliTensor.hpp.
using tket::dist_vec = typedef graphs::dist_vec |
Definition at line 34 of file Architecture.hpp.
typedef DAG::in_edge_iterator tket::E_in_iterator |
Definition at line 90 of file DAGDefs.hpp.
typedef boost::graph_traits<DAG>::edge_iterator tket::E_iterator |
Definition at line 89 of file DAGDefs.hpp.
typedef DAG::out_edge_iterator tket::E_out_iterator |
Definition at line 91 of file DAGDefs.hpp.
typedef boost::graph_traits<DAG>::edge_descriptor tket::Edge |
Definition at line 88 of file DAGDefs.hpp.
typedef std::map<Edge, Edge> tket::edge_map_t |
Definition at line 65 of file Circuit.hpp.
typedef std::pair<Edge, Edge> tket::edge_pair_t |
Definition at line 21 of file Cycles.hpp.
typedef std::list<Edge> tket::EdgeList |
Definition at line 94 of file DAGDefs.hpp.
typedef std::set<Edge> tket::EdgeSet |
Definition at line 92 of file DAGDefs.hpp.
typedef std::vector<Edge> tket::EdgeVec |
Definition at line 93 of file DAGDefs.hpp.
typedef SymEngine::Expression tket::Expr |
Representation of a phase as a multiple of \( \pi \).
Definition at line 48 of file Expression.hpp.
typedef SymEngine::RCP<const SymEngine::Basic> tket::ExprPtr |
Shared pointer to an Expr
.
Definition at line 53 of file Expression.hpp.
typedef double tket::gate_error_t |
Definition at line 24 of file ErrorTypes.hpp.
typedef std::shared_ptr<const Gate> tket::Gate_ptr |
Definition at line 24 of file GatePtr.hpp.
typedef std::vector<std::pair<std::vector<bool>, unsigned> > tket::gray_code_t |
Definition at line 390 of file ToffoliBox.cpp.
typedef std::vector<std::deque<bool> > tket::GrayCode |
Definition at line 25 of file HelperFunctions.hpp.
typedef std::unordered_map<Vertex, std::size_t> tket::IndexMap |
Definition at line 75 of file DAGDefs.hpp.
typedef std::map<Node, Node> tket::interacting_nodes_t |
Definition at line 22 of file LexicographicalComparison.hpp.
typedef boost::multi_index::multi_index_container< InteractionPoint, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::tag<TagKey>, boost::multi_index::const_mem_fun< InteractionPoint, std::pair<Edge, Vertex>, &InteractionPoint::key> >, boost::multi_index::hashed_non_unique< boost::multi_index::tag<TagEdge>, boost::multi_index::member< InteractionPoint, Edge, &InteractionPoint::e> >, boost::multi_index::hashed_non_unique< boost::multi_index::tag<TagSource>, boost::multi_index::member< InteractionPoint, Vertex, &InteractionPoint::source> > > > tket::interaction_table_t |
Stores all current InteractionPoints encountered.
Each gadget can only commute to a given edge in a unique way. Searching by edge is needed to search for possible matches. Searching by vertex is needed to remove InteractionPoints when a pair merge.
Definition at line 104 of file CliffordReductionPass.hpp.
typedef std::pair<std::size_t, Vertex> tket::IVertex |
A vertex with an index.
This can be used instead of a plain Vertex in associative containers where control over the order of iteration is required.
Definition at line 86 of file DAGDefs.hpp.
typedef std::vector<std::size_t> tket::lexicographical_distances_t |
Definition at line 25 of file LexicographicalComparison.hpp.
typedef std::shared_ptr<MappingFrontier> tket::MappingFrontier_ptr |
Definition at line 216 of file MappingFrontier.hpp.
typedef Eigen::Matrix<std::complex<double>, 8, 8> tket::Matrix8cd |
Definition at line 32 of file MatrixAnalysis.hpp.
typedef Eigen::Matrix<bool, Eigen::Dynamic, Eigen::Dynamic> tket::MatrixXb |
Definition at line 28 of file MatrixAnalysis.hpp.
typedef std::set<Node> tket::node_set_t |
Definition at line 322 of file UnitID.hpp.
typedef std::vector<Node> tket::node_vector_t |
Definition at line 323 of file UnitID.hpp.
typedef std::map<OpType, gate_error_t> tket::op_errors_t |
Definition at line 33 of file ErrorTypes.hpp.
typedef std::map<std::pair<Node, Node>, op_errors_t> tket::op_link_errors_t |
Definition at line 35 of file ErrorTypes.hpp.
typedef std::map<Node, op_errors_t> tket::op_node_errors_t |
Definition at line 34 of file ErrorTypes.hpp.
typedef std::shared_ptr<const Op> tket::Op_ptr |
typedef std::vector<EdgeType> tket::op_signature_t |
Definition at line 61 of file EdgeType.hpp.
typedef std::optional<register_info_t> tket::opt_reg_info_t |
Definition at line 43 of file UnitID.hpp.
typedef std::optional<unsigned> tket::OptUInt |
Optional unsigned integer.
Definition at line 26 of file OpDesc.hpp.
typedef std::unordered_set<OpType> tket::OpTypeSet |
Set of operation types.
Definition at line 25 of file OpTypeFunctions.hpp.
typedef std::vector<OpType> tket::OpTypeVector |
Vector of operation types.
Definition at line 28 of file OpTypeFunctions.hpp.
typedef std::function<void(const CompilationUnit&, const nlohmann::json&)> tket::PassCallback |
Definition at line 34 of file CompilerPass.hpp.
typedef std::pair<PredicatePtrMap, PostConditions> tket::PassConditions |
Definition at line 32 of file CompilerPass.hpp.
typedef std::shared_ptr<BasePass> tket::PassPtr |
Definition at line 30 of file CompilerPass.hpp.
typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, SpPauliString> tket::PauliACGraph |
A PauliACGraph is a graph where each vertex is a Pauli tensor, and an edge corresponds to anticommuting tensors.
Definition at line 39 of file PauliPartition.hpp.
typedef boost::graph_traits<PauliACGraph>::vertex_descriptor tket::PauliACVertex |
Definition at line 41 of file PauliPartition.hpp.
typedef boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, boost::property<boost::vertex_index_t, int, PauliGadgetProperties>, DependencyEdgeProperties> tket::PauliDAG |
Definition at line 40 of file PauliGraph.hpp.
typedef boost::graph_traits<PauliDAG>::edge_descriptor tket::PauliEdge |
Definition at line 42 of file PauliGraph.hpp.
typedef sequence_set_t<PauliEdge> tket::PauliEdgeSet |
Definition at line 45 of file PauliGraph.hpp.
Definition at line 1043 of file PauliTensor.hpp.
typedef std::vector<PauliStabiliser> tket::PauliStabiliserVec |
Definition at line 1049 of file PauliTensor.hpp.
typedef PauliTensor<DensePauliMap, no_coeff_t> tket::PauliString |
Definition at line 1041 of file PauliTensor.hpp.
typedef boost::graph_traits<PauliDAG>::vertex_descriptor tket::PauliVert |
Definition at line 41 of file PauliGraph.hpp.
typedef sequence_set_t<PauliVert> tket::PauliVertSet |
Definition at line 44 of file PauliGraph.hpp.
typedef boost::adj_list_vertex_property_map< PauliDAG, int, int &, boost::vertex_index_t> tket::PauliVIndex |
Definition at line 49 of file PauliGraph.hpp.
typedef boost::graph_traits<cube_graph_t>::vertex_descriptor tket::perm_vert_t |
Definition at line 118 of file ToffoliBox.cpp.
typedef std::unordered_map<unsigned, unsigned> tket::permutation_t |
Definition at line 111 of file Circuit.hpp.
typedef std::pair<std::vector<bool>, Expr> tket::phase_term_t |
Definition at line 29 of file PhasePoly.hpp.
typedef std::map<std::vector<bool>, Expr> tket::PhasePolynomial |
PhasePolynomial is just a sequence of parities: that is, terms of the form \( e^{\alpha \bigotimes Z} \), where Z is a Pauli Z.
This is capable of representing a restricted set of circuits made up of CNOTs and Rzs: specifically, circuits where the output qubits have the same state as the inputs, modulo (local) phases. The vectors are always assumed to be the same size as the qubit count.
Definition at line 28 of file PhasePoly.hpp.
typedef unsigned tket::port_t |
typedef std::map<std::type_index, std::pair<PredicatePtr, bool> > tket::PredicateCache |
Definition at line 27 of file CompilationUnit.hpp.
typedef std::map<std::type_index, Guarantee> tket::PredicateClassGuarantees |
Definition at line 31 of file CompilerPass.hpp.
typedef std::shared_ptr<Predicate> tket::PredicatePtr |
Definition at line 25 of file Predicates.hpp.
typedef std::map<std::type_index, PredicatePtr> tket::PredicatePtrMap |
Definition at line 25 of file CompilationUnit.hpp.
typedef std::vector<VertPort> tket::QPathDetailed |
Definition at line 61 of file Circuit.hpp.
typedef unsigned tket::quarter_turns_t |
A fourth root of unity {1, i, -1, -i}, represented as an unsigned integer giving the power of i.
E.g. val % 4: 0: +1 1: +i 2: -1 3: -i
These are the phase coefficients generated in the Pauli group. Whilst stabilisers are restricted to {1, -1}, the imaginary numbers are required for closure under multiplication. For settings where a real value is needed, use PauliTensor::is_real_negative() which asserts the value is real (throws an exception otherwise) and returns a bool value to distinguish.
Definition at line 81 of file PauliTensor.hpp.
typedef std::map<Qubit, Qubit> tket::qubit_map_t |
Definition at line 316 of file UnitID.hpp.
typedef std::vector<Qubit> tket::qubit_vector_t |
Definition at line 315 of file UnitID.hpp.
typedef std::map<SpPauliString, Expr> tket::QubitOperator |
QubitOperator, defined to be useful for diagonalisation and partitioning.
Definition at line 25 of file DiagUtils.hpp.
typedef std::map<Qubit, Pauli> tket::QubitPauliMap |
A sparse, Qubit-indexed Pauli container.
A QubitPauliMap is generally treated the same as if all Pauli::I entries were removed.
Definition at line 254 of file PauliTensor.hpp.
typedef double tket::readout_error_t |
Definition at line 25 of file ErrorTypes.hpp.
typedef std::pair<UnitType, unsigned> tket::register_info_t |
The type and dimension of a register.
Definition at line 41 of file UnitID.hpp.
typedef std::map<unsigned, UnitID> tket::register_t |
A register of locations sharing the same name.
Definition at line 326 of file UnitID.hpp.
using tket::RelabelledPatternGraph = typedef RelabelledGraphWSM<Qubit, QubitGraph::UndirectedConnGraph> |
Definition at line 24 of file MonomorphismCalculation.cpp.
using tket::RelabelledTargetGraph = typedef RelabelledGraphWSM<Node, Architecture::UndirectedConnGraph> |
Definition at line 26 of file MonomorphismCalculation.cpp.
typedef std::shared_ptr<const RoutingMethod> tket::RoutingMethodPtr |
Definition at line 57 of file RoutingMethod.hpp.
using tket::sequence_set_t = typedef boost::multi_index::multi_index_container< T, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag<TagKey>, boost::multi_index::identity<T> >, boost::multi_index::sequenced<boost::multi_index::tag<TagSeq> >> > |
Definition at line 54 of file SequencedContainers.hpp.
using tket::sequenced_bimap_t = typedef boost::multi_index::multi_index_container< std::pair<A, B>, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag<TagKey>, boost::multi_index::member< std::pair<A, B>, A, &std::pair<A, B>::first> >, boost::multi_index::ordered_unique< boost::multi_index::tag<TagValue>, boost::multi_index::member< std::pair<A, B>, B, &std::pair<A, B>::second> >, boost::multi_index::sequenced<boost::multi_index::tag<TagSeq> >> > |
Definition at line 30 of file SequencedContainers.hpp.
using tket::sequenced_map_t = typedef boost::multi_index::multi_index_container< std::pair<A, B>, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag<TagKey>, boost::multi_index::member< std::pair<A, B>, A, &std::pair<A, B>::first> >, boost::multi_index::sequenced<boost::multi_index::tag<TagSeq> >> > |
Definition at line 44 of file SequencedContainers.hpp.
typedef VertexVec tket::Slice |
Definition at line 24 of file Slices.hpp.
typedef std::vector<Slice> tket::SliceVec |
Definition at line 59 of file Circuit.hpp.
typedef Eigen::SparseMatrix<std::complex<double> > tket::SparseMatrixXcd |
Definition at line 121 of file MatrixAnalysis.hpp.
typedef PauliTensor<QubitPauliMap, Complex> tket::SpCxPauliTensor |
Definition at line 1044 of file PauliTensor.hpp.
Definition at line 1042 of file PauliTensor.hpp.
Definition at line 1040 of file PauliTensor.hpp.
typedef PauliTensor<QubitPauliMap, Expr> tket::SpSymPauliTensor |
Definition at line 1046 of file PauliTensor.hpp.
typedef std::map<std::vector<bool>, std::vector<bool> > tket::state_perm_t |
Map bitstrings to bitstrings.
Definition at line 38 of file ToffoliBox.hpp.
typedef Eigen::VectorXcd tket::StateVector |
Definition at line 22 of file CircuitSimulator.hpp.
typedef std::set<swap_t> tket::swap_set_t |
Definition at line 24 of file LexicographicalComparison.hpp.
typedef std::pair<Node, Node> tket::swap_t |
Definition at line 23 of file LexicographicalComparison.hpp.
typedef SymEngine::RCP<const SymEngine::Symbol> tket::Sym |
Shared pointer to a free symbol.
Definition at line 56 of file Expression.hpp.
typedef std::map<Sym, Expr, SymEngine::RCPBasicKeyLess> tket::symbol_map_t |
Map from symbols to expressions.
Definition at line 99 of file Expression.hpp.
typedef PauliTensor<DensePauliMap, Expr> tket::SymPauliTensor |
Definition at line 1047 of file PauliTensor.hpp.
typedef std::set<Sym, SymCompareLess> tket::SymSet |
Definition at line 96 of file Expression.hpp.
typedef Eigen::Triplet<std::complex<double> > tket::TripletCd |
It is sometimes more convenient to deal with Triplets directly, rather than sparse matrices.
Definition at line 119 of file MatrixAnalysis.hpp.
typedef std::pair<VertPort, ZXPortType> tket::TypedVertPort |
Definition at line 24 of file ZXConverters.cpp.
typedef std::pair<const std::type_index, PredicatePtr> tket::TypePredicatePair |
Definition at line 26 of file CompilationUnit.hpp.
typedef boost::bimap<UnitID, UnitID> tket::unit_bimap_t |
A correspondence between two sets of unit IDs.
Definition at line 303 of file UnitID.hpp.
typedef sequenced_map_t<UnitID, Edge> tket::unit_frontier_t |
Definition at line 26 of file Slices.hpp.
typedef std::map<UnitID, UnitID> tket::unit_map_t |
Definition at line 312 of file UnitID.hpp.
typedef std::set<UnitID> tket::unit_set_t |
Definition at line 313 of file UnitID.hpp.
typedef std::vector<UnitID> tket::unit_vector_t |
Definition at line 311 of file UnitID.hpp.
Definition at line 23 of file MappingFrontier.hpp.
typedef boost::graph_traits<DAG>::vertex_iterator tket::V_iterator |
Definition at line 71 of file DAGDefs.hpp.
typedef Eigen::Matrix<bool, 2, 1> tket::Vector2b |
Definition at line 30 of file MatrixAnalysis.hpp.
typedef Eigen::Matrix<bool, Eigen::Dynamic, 1> tket::VectorXb |
Definition at line 29 of file MatrixAnalysis.hpp.
typedef boost::graph_traits<DAG>::vertex_descriptor tket::Vertex |
Definition at line 70 of file DAGDefs.hpp.
typedef std::unordered_map<Vertex, Vertex> tket::vertex_map_t |
Definition at line 62 of file Circuit.hpp.
typedef std::list<Vertex> tket::VertexList |
Definition at line 74 of file DAGDefs.hpp.
typedef std::unordered_set<Vertex> tket::VertexSet |
Definition at line 72 of file DAGDefs.hpp.
typedef std::vector<Vertex> tket::VertexVec |
Definition at line 73 of file DAGDefs.hpp.
typedef std::pair<Vertex, port_t> tket::VertPort |
Definition at line 96 of file DAGDefs.hpp.
typedef boost::adj_list_vertex_property_map< DAG, std::size_t, std::size_t&, boost::vertex_index_t> tket::VIndex |
Definition at line 78 of file DAGDefs.hpp.
typedef std::pair<ZXVert, std::optional<unsigned> > tket::ZXVertPort |
Definition at line 25 of file ZXConverters.cpp.
typedef std::vector<ZXVertPort> tket::ZXVertPortVec |
Definition at line 26 of file ZXConverters.cpp.
|
strong |
Enum for readout basis and ordering.
Readouts are viewed in increasing lexicographic order (ILO) of the bit's UnitID. This is our default convention for column indexing for ALL readout forms (shots, counts, statevector, and unitaries). e.g. |abc> corresponds to the readout: ('c', 0) --> a, ('c', 1) --> b, ('d', 0) --> c
For statevector and unitaries, the string abc is interpreted as an index in a big-endian (BE) fashion. e.g. the statevector (a_{00}, a_{01}, a_{10}, a_{11})
Some backends (Qiskit, ProjectQ, Quest, etc.) use a DLO-BE (decreasing lexicographic order, big-endian) convention. This is the same as ILO-LE (little-endian) for statevectors and unitaries, but gives shot tables/readouts in a counter-intuitive manner.
Every backend and matrix-based box should have a BasisOrder option which can toggle between ILO-BE (ilo) and DLO-BE (dlo).
Enumerator | |
---|---|
ilo | increasing lexicographic order (big-endian) |
dlo | decreasing lexicographic order (big-endian) |
Definition at line 64 of file Constants.hpp.
|
strong |
An function acting on bits or bit registers.
Definition at line 39 of file ClExpr.hpp.
|
strong |
Whenever a decomposition choice of Pauli gadgets is presented, users may use either Snake (a.k.a.
cascade, ladder), Tree (i.e. CX balanced tree) or Star (i.e. CXs target a common qubit).
Enumerator | |
---|---|
Snake | |
Tree | |
Star | |
MultiQGate |
Definition at line 41 of file PauliTensor.hpp.
|
strong |
Type of a wire in a circuit or input to an op.
Enumerator | |
---|---|
Quantum | A wire carrying quantum information, corresponding to some allocated Qubit. Since these are persistent, every node in the DAG (except for an input or output) has the same number of Quantum input and output wires. |
Classical | A wire carrying classical information, corresponding to some allocated Bit. Since these are persistent, every node in the DAG (except for an input or output) has the same number of Classical input and output wires. |
Boolean | A wire carrying a bit of classical information from a classical output port of one op to a classical input port of another, not corresponding to any allocated Bit. |
WASM | A wire to connect the wasm ops in the order they should be executed in. Corresponding to some allocated WasmState. |
Definition at line 23 of file EdgeType.hpp.
|
strong |
A choice of methods to perform graph colouring for Pauli partitioning.
Definition at line 62 of file PauliPartition.hpp.
|
strong |
Enumerator | |
---|---|
Clear | |
Preserve |
Definition at line 54 of file CompilerPass.hpp.
|
strong |
Named operation types.
When a unitary matrix is specified in the descriptions below, the order of rows and columns follows the BasisOrder::ilo convention.
Operations have defined phase.
Enumerator | |
---|---|
Input | Quantum input node of the circuit. |
Output | Quantum output node of the circuit. |
Create | Quantum node with no predecessors, implicitly in zero state. |
Discard | Quantum node with no successors, not composable with input nodes of other circuits. |
ClInput | Classical input node of the circuit. |
ClOutput | Classical output node of the circuit. |
WASMInput | WASM input node of the circuit. |
WASMOutput | WASM output node of the circuit. |
Barrier | No-op that must be preserved by compilation. |
Label | FlowOp introducing a target for Branch or Goto commands. |
Branch | Execution jumps to a label if a condition bit is true (1), otherwise continues to next command. |
Goto | Execution jumps to a label unconditionally. |
Stop | Execution halts and the program terminates. |
ClassicalTransform | A general classical operation where all inputs are also outputs. |
WASM | Op containing a classical wasm function call. |
SetBits | An operation to set some bits to specified values. |
CopyBits | An operation to copy some bit values. |
RangePredicate | A classical predicate defined by a range of values in binary encoding. |
ExplicitPredicate | A classical predicate defined by a truth table. |
ExplicitModifier | An operation defined by a truth table that modifies one bit. |
MultiBit | A classical operation applied to multiple bits simultaneously. |
Phase | \( \mathrm{Phase}(\alpha) = \left[ \begin{array}{c} e^{i \pi \alpha} \end{array} \right] \) |
Z | \( \left[ \begin{array}{cc} 1 & 0 \\ 0 & -1 \end{array} \right] \) |
X | \( \left[ \begin{array}{cc} 0 & 1 \\ 1 & 0 \end{array} \right] \) |
Y | \( \left[ \begin{array}{cc} 0 & -i \\ i & 0 \end{array} \right] \) |
S | \( \left[ \begin{array}{cc} 1 & 0 \\ 0 & i \end{array} \right] = \mathrm{U1}(\frac12) \) |
Sdg | \( \left[ \begin{array}{cc} 1 & 0 \\ 0 & -i \end{array} \right] = \mathrm{U1}(-\frac12) \) |
T | \( \left[ \begin{array}{cc} 1 & 0 \\ 0 & e^{i\pi/4} \end{array} \right] = \mathrm{U1}(\frac14) \) |
Tdg | \( \left[ \begin{array}{cc} 1 & 0 \\ 0 & e^{-i\pi/4} \end{array} \right] \equiv \mathrm{U1}(-\frac14) \) |
V | \( \frac{1}{\sqrt 2} \left[ \begin{array}{cc} 1 & -i \\ -i & 1 \end{array} \right] = \mathrm{Rx}(\frac12) \) |
Vdg | \( \frac{1}{\sqrt 2} \left[ \begin{array}{cc} 1 & i \\ i & 1 \end{array} \right] = \mathrm{Rx}(-\frac12) \) |
SX | \( \frac{1}{2} \left[ \begin{array}{cc} 1+i & 1-i \\ 1-i & 1+i \end{array} \right] = e^{\frac{i\pi}{4}}\mathrm{Rx}(\frac12) \) |
SXdg | \( \frac{1}{2} \left[ \begin{array}{cc} 1-i & 1+i \\ 1+i & 1-i \end{array} \right] = e^{\frac{-i\pi}{4}}\mathrm{Rx}(-\frac12) \) |
H | \( \frac{1}{\sqrt 2} \left[ \begin{array}{cc} 1 & 1 \\ 1 & -1 \end{array} \right] \) |
Rx | \( \mathrm{Rx}(\alpha) = e^{-\frac12 i \pi \alpha X} = \left[ \begin{array}{cc} \cos\frac{\pi\alpha}{2} & -i\sin\frac{\pi\alpha}{2} \\ -i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} \end{array} \right] \) |
Ry | \( \mathrm{Ry}(\alpha) = e^{-\frac12 i \pi \alpha Y} = \left[ \begin{array}{cc} \cos\frac{\pi\alpha}{2} & -\sin\frac{\pi\alpha}{2} \\ \sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} \end{array} \right] \) |
Rz | \( \mathrm{Rz}(\alpha) = e^{-\frac12 i \pi \alpha Z} = \left[ \begin{array}{cc} e^{-\frac12 i \pi\alpha} & 0 \\ 0 & e^{\frac12 i \pi\alpha} \end{array} \right] \) |
U3 | \( \mathrm{U3}(\theta, \phi, \lambda) = \left[ \begin{array}{cc} \cos\frac{\pi\theta}{2} & -e^{i\pi\lambda} \sin\frac{\pi\theta}{2} \\ e^{i\pi\phi} \sin\frac{\pi\theta}{2} & e^{i\pi(\lambda+\phi)} \cos\frac{\pi\theta}{2} \end{array} \right] = e^{\frac12 i\pi(\lambda+\phi)} \mathrm{Rz}(\phi) \mathrm{Ry}(\theta) \mathrm{Rz}(\lambda) \) |
U2 | \( \mathrm{U2}(\phi, \lambda) = \mathrm{U3}(\frac12, \phi, \lambda) = e^{\frac12 i\pi(\lambda+\phi)} \mathrm{Rz}(\phi) \mathrm{Ry}(\frac12) \mathrm{Rz}(\lambda) \) |
U1 | \( \mathrm{U1}(\lambda) = \mathrm{U3}(0, 0, \lambda) = e^{\frac12 i\pi\lambda} \mathrm{Rz}(\lambda) \) |
GPI | \( \mathrm{GPI}(\phi) = \left[ \begin{array}{cc} 0 & e^{-i\pi\phi} \\ e^{i\pi\phi} & 0 \end{array} \right] \) |
GPI2 | \( \mathrm{GPI2}(\phi) = \frac{1}{\sqrt 2} \left[ \begin{array}{cc} 1 & -ie^{-i\pi\phi} \\ -ie^{i\pi\phi} & 1 \end{array} \right] \) |
AAMS | \( \mathrm{AAMS}(\theta, \phi_0, \phi_1) = \left[ \begin{array}{cccc} \cos\frac{\pi\theta}{2} & 0 & 0 & -ie^{-i\pi(\phi_0+\phi_1)}\sin\frac{\pi\theta}{2} \\ 0 & \cos\frac{\pi\theta}{2} & -ie^{i\pi(\phi_1-\phi_0)}\sin\frac{\pi\theta}{2} & 0 \\ 0 & -ie^{i\pi(\phi_0-\phi_1)}\sin\frac{\pi\theta}{2} & \cos\frac{\pi\theta}{2} & 0 \\ -ie^{i\pi(\phi_0+\phi_1)}\sin\frac{\pi\theta}{2} & 0 & 0 & \cos\frac{\pi\theta}{2} \end{array} \right] \) |
TK1 | \( \mathrm{TK1}(\alpha, \beta, \gamma) = \mathrm{Rz}(\alpha) \mathrm{Rx}(\beta) \mathrm{Rz}(\gamma) \) |
TK2 | \( \mathrm{TK2}(\alpha, \beta, \gamma) = \mathrm{XXPhase}(\alpha) \mathrm{YYPhase}(\beta) \mathrm{ZZPhase}(\gamma) \) |
CX | Controlled OpType::X. |
CY | Controlled OpType::Y. |
CZ | Controlled OpType::Z. |
CH | Controlled OpType::H. |
CV | Controlled OpType::V. \( \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \frac{1}{\sqrt 2} & -i \frac{1}{\sqrt 2} \\ 0 & 0 & -i \frac{1}{\sqrt 2} & \frac{1}{\sqrt 2} \end{array} \right] \) |
CVdg | Controlled OpType::Vdg. \( \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \frac{1}{\sqrt 2} & i \frac{1}{\sqrt 2} \\ 0 & 0 & i \frac{1}{\sqrt 2} & \frac{1}{\sqrt 2} \end{array} \right] \) |
CSX | Controlled OpType::SX. \( \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \frac{1+i}{2} & \frac{1-i}{2} \\ 0 & 0 & \frac{1-i}{2} & \frac{1+i}{2} \end{array} \right] \) |
CSXdg | Controlled OpType::SXdg. \( \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \frac{1-i}{2} & \frac{1+i}{2} \\ 0 & 0 & \frac{1+i}{2} & \frac{1-i}{2} \end{array} \right] \) |
CS | Controlled OpType::S. \( \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & i \end{array} \right] = \mathrm{CU1}(\frac12) \) |
CSdg | Controlled OpType::Sdg. \( \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -i \end{array} \right] = \mathrm{CU1}(-\frac12) \) |
CRz | Controlled OpType::Rz. \( \mathrm{CRz}(\alpha) = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & e^{-\frac12 i \pi\alpha} & 0 \\ 0 & 0 & 0 & e^{\frac12 i \pi\alpha} \end{array} \right] \) The phase parameter \( \alpha \) is defined modulo \( 4 \). |
CRx | Controlled OpType::Rx. \( \mathrm{CRx}(\alpha) = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \cos \frac{\pi \alpha}{2} & -i \sin \frac{\pi \alpha}{2} \\ 0 & 0 & -i \sin \frac{\pi \alpha}{2} & \cos \frac{\pi \alpha}{2} \end{array} \right] \) The phase parameter \( \alpha \) is defined modulo \( 4 \). |
CRy | Controlled OpType::Ry. \( \mathrm{CRy}(\alpha) = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & \cos \frac{\pi \alpha}{2} & -\sin \frac{\pi \alpha}{2} \\ 0 & 0 & \sin \frac{\pi \alpha}{2} & \cos \frac{\pi \alpha}{2} \end{array} \right] \) The phase parameter \( \alpha \) is defined modulo \( 4 \). |
CU1 | Controlled OpType::U1. \( \mathrm{CU1}(\alpha) = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & e^{i\pi\alpha} \end{array} \right] \) |
CU3 | Controlled OpType::U3. |
PhaseGadget | \( \alpha \mapsto e^{-\frac12 i \pi\alpha Z^{\otimes n}} \) |
CCX | Controlled OpType::CX. |
SWAP | Swap two qubits. |
CSWAP | Controlled OpType::SWAP. |
BRIDGE | Three-qubit gate that swaps the first and third qubits. |
noop | Identity. |
Measure | Measure a qubit, producing a classical output. |
Collapse | Measure a qubit producing no output. |
Reset | Reset a qubit to the zero state. |
ECR | \( \frac{1}{\sqrt 2} \left[ \begin{array}{cccc} 0 & 0 & 1 & i \\ 0 & 0 & i & 1 \\ 1 & -i & 0 & 0 \\ -i & 1 & 0 & 0 \end{array} \right] \) |
ISWAP | \( \alpha \mapsto e^{\frac14 i \pi\alpha (X \otimes X + Y \otimes Y)} = \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & \cos\frac{\pi\alpha}{2} & i\sin\frac{\pi\alpha}{2} & 0 \\ 0 & i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} & 0 \\ 0 & 0 & 0 & 1 \end{array} \right] \) Also known as an XY gate. |
PhasedX | \( (\alpha, \beta) \mapsto \mathrm{Rz}(\beta) \mathrm{Rx}(\alpha) \mathrm{Rz}(-\beta) \) |
NPhasedX | PhasedX gates on multiple qubits. |
ZZMax | \( \mathrm{ZZPhase}(\frac12) \) |
XXPhase | \( \alpha \mapsto e^{-\frac12 i \pi\alpha (X \otimes X)} = \left[ \begin{array}{cccc} \cos\frac{\pi\alpha}{2} & 0 & 0 & -i\sin\frac{\pi\alpha}{2} \\ 0 & \cos\frac{\pi\alpha}{2} & -i\sin\frac{\pi\alpha}{2} & 0 \\ 0 & -i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} & 0 \\ -i\sin\frac{\pi\alpha}{2} & 0 & 0 & \cos\frac{\pi\alpha}{2} \end{array} \right] \) |
YYPhase | \( \alpha \mapsto e^{-\frac12 i \pi\alpha (Y \otimes Y)} = \left[ \begin{array}{cccc} \cos\frac{\pi\alpha}{2} & 0 & 0 & i\sin\frac{\pi\alpha}{2} \\ 0 & \cos\frac{\pi\alpha}{2} & -i\sin\frac{\pi\alpha}{2} & 0 \\ 0 & -i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} & 0 \\ i\sin\frac{\pi\alpha}{2} & 0 & 0 & \cos\frac{\pi\alpha}{2} \end{array} \right] \) |
ZZPhase | \( \alpha \mapsto e^{-\frac12 i \pi\alpha (Z \otimes Z)} = \left[ \begin{array}{cccc} e^{-\frac12 i \pi\alpha} & 0 & 0 & 0 \\ 0 & e^{\frac12 i \pi\alpha} & 0 & 0 \\ 0 & 0 & e^{\frac12 i \pi\alpha} & 0 \\ 0 & 0 & 0 & e^{-\frac12 i \pi\alpha} \end{array} \right] \) |
XXPhase3 | Three-qubit phase MSGate. |
ESWAP | \( \alpha \mapsto e^{-\frac12 i\pi\alpha \cdot \mathrm{SWAP}} = \left[ \begin{array}{cccc} e^{-\frac12 i \pi\alpha} & 0 & 0 & 0 \\ 0 & \cos\frac{\pi\alpha}{2} & -i\sin\frac{\pi\alpha}{2} & 0 \\ 0 & -i\sin\frac{\pi\alpha}{2} & \cos\frac{\pi\alpha}{2} & 0 \\ 0 & 0 & 0 & e^{-\frac12 i \pi\alpha} \end{array} \right] \) |
FSim | \( (\alpha, \beta) \mapsto \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & \cos \pi\alpha & -i\sin \pi\alpha & 0 \\ 0 & -i\sin \pi\alpha & \cos \pi\alpha & 0 \\ 0 & 0 & 0 & e^{-i\pi\beta} \end{array} \right] \) |
Sycamore | Fixed instance of a OpType::FSim gate with parameters \( (\frac12, \frac16) \): \( \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 0 & -i & 0 \\ 0 & -i & 0 & 0 \\ 0 & 0 & 0 & e^{-i\pi/6} \end{array} \right] \). |
ISWAPMax | Fixed instance of a OpType::ISWAP gate with parameter \( 1.0 \): \( \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & 0 & i & 0 \\ 0 & i & 0 & 0 \\ 0 & 0 & 0 & 1 \end{array} \right] \). |
PhasedISWAP | \( (p, t) \mapsto \left[ \begin{array}{cccc} 1 & 0 & 0 & 0 \\ 0 & \cos\frac{\pi t}{2} & i\sin\frac{\pi t}{2}e^{2i\pi p} & 0 \\ 0 & i\sin\frac{\pi t}{2}e^{-2i\pi p} & \cos\frac{\pi t}{2} & 0 \\ 0 & 0 & 0 & 1 \end{array} \right] \) This is equivalent to: --Rz(+p)---\ /---Rz(-p)-- ISWAP(t) --Rz(-p)---/ \---Rz(+p)-- |
CnRy | Multiply-controlled OpType::Ry. The phase parameter is defined modulo \( 4 \). |
CnRx | Multiply-controlled OpType::Rx. The phase parameter is defined modulo \( 4 \). |
CnRz | Multiply-controlled OpType::Rz. The phase parameter is defined modulo \( 4 \). |
CnX | Multiply-controlled OpType::X. |
CnZ | Multiply-controlled OpType::Z. |
CnY | Multiply-controlled OpType::Y. |
CircBox | See CircBox. |
Unitary1qBox | See Unitary1qBox. |
Unitary2qBox | See Unitary2qBox. |
Unitary3qBox | See Unitary3qBox. |
ExpBox | See ExpBox. |
PauliExpBox | See PauliExpBox. |
PauliExpPairBox | See PauliExpPairBox. |
PauliExpCommutingSetBox | |
TermSequenceBox | See TermSequenceBox. |
CliffBox | NYI. |
CustomGate | See CustomGate. |
PhasePolyBox | See PhasePolyBox. |
QControlBox | See QControlBox. |
MultiplexorBox | See MultiplexorBox. |
MultiplexedRotationBox | |
MultiplexedU2Box | See MultiplexedU2Box. |
MultiplexedTensoredU2Box | |
StatePreparationBox | See StatePreparationBox. |
DiagonalBox | See DiagonalBox. |
ConjugationBox | See ConjugationBox. |
Conditional | See Conditional. |
ProjectorAssertionBox | |
StabiliserAssertionBox | |
ToffoliBox | See ToffoliBox. |
UnitaryTableauBox | See UnitaryTableauBox. |
DummyBox | See DummyBox. |
ClExpr | Function defined over bits and sequences of bits treated as integers. |
Definition at line 29 of file OpType.hpp.
enum tket::Pauli |
Symbols for the Pauli operators (and identity)
Enumerator | |
---|---|
I | |
X | |
Y | |
Z |
Definition at line 26 of file PauliTensor.hpp.
|
strong |
A choice of strategies to partition Pauli tensors into sets.
Definition at line 46 of file PauliPartition.hpp.
|
strong |
Whether a vertex port is out-going (source) or in-coming (target)
Enumerator | |
---|---|
Source | |
Target |
Definition at line 44 of file DAGDefs.hpp.
|
strong |
Indicates whether a recursion step in recursive_demultiplex_rotation is either a left child, a right child, or the root.
Enumerator | |
---|---|
Left | |
Right | |
Root |
Definition at line 69 of file Multiplexor.cpp.
enum tket::ReverseType |
Enumerator | |
---|---|
dagger | |
transpose |
Definition at line 201 of file Circuit.hpp.
|
strong |
Enumerator | |
---|---|
Audit | |
Default | |
Off |
Definition at line 56 of file CompilerPass.hpp.
|
strong |
Strategies for synthesising ToffoliBoxes Matching: use multiplexors to perform parallel swaps on hypercubes Cycle: use CnX gates to perform transpositions.
Enumerator | |
---|---|
Matching | |
Cycle |
Definition at line 28 of file ToffoliBox.hpp.
|
strong |
|
strong |
Enumerator | |
---|---|
Quantum | |
Classical | |
Measure |
Definition at line 36 of file DAGProperties.cpp.
|
strong |
Enumerator | |
---|---|
In | |
Out |
Definition at line 23 of file ZXConverters.cpp.
PassPtr tket::aas_routing_pass | ( | const Architecture & | arc, |
const unsigned | lookahead = 1 , |
||
const aas::CNotSynthType | cnotsynthtype = aas::CNotSynthType::Rec |
||
) |
execute architecture aware synthesis on a given architecture for an allready place circuit, only for circuit which contains Cx+Rz+H gates this pass is not able to handle implicit wire swaps
arc | architecture to route on |
lookahead | parameter for the recursion depth in the algorithm, the value should be > 0 |
cnotsynthtype | parameter for the type of cnot synth |
Definition at line 625 of file PassGenerators.cpp.
std::pair< std::pair< ZXVertPort, ZXVertPort >, ZXVertPortVec > tket::add_conditional_zx | ( | ZXDiagram & | zxd, |
const ZXVert & | left, | ||
const ZXVert & | right, | ||
const QuantumType & | qtype | ||
) |
Definition at line 62 of file ZXConverters.cpp.
void tket::add_cx_u1 | ( | Circuit & | circ, |
const std::vector< MultiplexedU2Commands > & | m_u2_decomps, | ||
unsigned | n_controls_, | ||
unsigned | n_targets_ | ||
) |
Definition at line 917 of file Multiplexor.cpp.
void tket::add_latex_for_command | ( | LatexContext & | context, |
const Command & | command | ||
) |
Definition at line 34 of file latex_drawing.cpp.
void tket::add_multi_rz | ( | Circuit & | circ, |
const std::vector< ctrl_op_map_t > & | all_multiplexed_rz, | ||
unsigned | n_controls_, | ||
unsigned | n_targets_ | ||
) |
Definition at line 992 of file Multiplexor.cpp.
std::pair< ZXVertPortVec, ZXVertPort > tket::add_n_bit_and | ( | ZXDiagram & | zxd, |
unsigned | n, | ||
const QuantumType & | qtype | ||
) |
Definition at line 89 of file ZXConverters.cpp.
Definition at line 47 of file FrameRandomisation.cpp.
std::pair< ZXVertPort, ZXVertPort > tket::add_switch | ( | ZXDiagram & | zxd, |
const bool & | on_value, | ||
const QuantumType & | qtype | ||
) |
Definition at line 36 of file ZXConverters.cpp.
const OpTypeSet & tket::all_classical_types | ( | ) |
Set of all classical gates.
Definition at line 105 of file OpTypeFunctions.cpp.
const OpTypeSet & tket::all_controlled_gate_types | ( | ) |
Set of all controlled gates.
Definition at line 130 of file OpTypeFunctions.cpp.
const OpTypeSet & tket::all_gate_types | ( | ) |
Set of all elementary gates.
Definition at line 27 of file OpTypeFunctions.cpp.
const OpTypeSet & tket::all_multi_qubit_types | ( | ) |
Set of all gates over more than one qubit.
Definition at line 57 of file OpTypeFunctions.cpp.
const OpTypeSet & tket::all_projective_types | ( | ) |
Set of all measurement and reset gates.
Definition at line 122 of file OpTypeFunctions.cpp.
const OpTypeSet & tket::all_single_qubit_types | ( | ) |
Set of all gates over a single qubit.
Definition at line 91 of file OpTypeFunctions.cpp.
const OpTypeSet & tket::all_single_qubit_unitary_types | ( | ) |
Set of all single-qubit gates that can be expressed as TK1.
Definition at line 79 of file OpTypeFunctions.cpp.
std::shared_ptr< ExplicitPredicateOp > tket::AndOp | ( | ) |
Binary AND operator.
Definition at line 442 of file ClassicalOps.cpp.
std::shared_ptr< ExplicitModifierOp > tket::AndWithOp | ( | ) |
In-place AND with another input.
Definition at line 463 of file ClassicalOps.cpp.
void tket::append_commuting_pauli_gadget_set_as_box | ( | Circuit & | circ, |
const std::list< SpSymPauliTensor > & | gadgets, | ||
CXConfigType | cx_config | ||
) |
Constructs a PauliExpCommutingSetBox for a set of mutually commuting pauli gadgets and appends it to a circuit.
As the pauli gadgets all commute, the ordering does not matter semantically, but may yield different synthesised circuits.
circ | The circuit to append the box to |
gadgets | Description of the pauli gadgets; coefficients give the rotation angles in half-turns |
cx_config | The CX configuration to be used during synthesis |
Definition at line 718 of file PauliExpBoxes.cpp.
void tket::append_pauli_gadget_pair_as_box | ( | Circuit & | circ, |
const SpSymPauliTensor & | pauli0, | ||
const SpSymPauliTensor & | pauli1, | ||
CXConfigType | cx_config | ||
) |
Constructs a PauliExpPairBox for a pair of pauli gadgets and appends it to a circuit.
The pauli gadgets may or may not commute, so the ordering matters.
circ | The circuit to append the box to |
pauli0 | The pauli operator of the first gadget; coefficient gives the rotation angle in half-turns |
pauli1 | The pauli operator of the second gadget; coefficient gives the rotation angle in half-turns |
cx_config | The CX configuration to be used during synthesis |
Definition at line 686 of file PauliExpBoxes.cpp.
void tket::append_single_pauli_gadget_as_pauli_exp_box | ( | Circuit & | circ, |
const SpSymPauliTensor & | pauli, | ||
CXConfigType | cx_config | ||
) |
Constructs a PauliExpBox for a single pauli gadget and appends it to a circuit.
circ | The circuit to append the box to |
pauli | The pauli operator of the gadget; coefficient gives the rotation angle in half-turns |
cx_config | The CX configuration to be used during synthesis |
Definition at line 674 of file PauliExpBoxes.cpp.
void tket::apply_conjugations | ( | SpSymPauliTensor & | qps, |
const Conjugations & | conjugations | ||
) |
Applies Clifford conjugations to a SpSymPauliTensor.
Definition at line 310 of file Diagonalisation.cpp.
Eigen::MatrixXcd tket::apply_qubit_permutation | ( | const Eigen::MatrixXcd & | m, |
const qubit_map_t & | perm | ||
) |
Definition at line 280 of file MatrixAnalysis.cpp.
Eigen::VectorXcd tket::apply_qubit_permutation | ( | const Eigen::VectorXcd & | v, |
const qubit_map_t & | perm | ||
) |
Definition at line 286 of file MatrixAnalysis.cpp.
Test if an expression is approximately zero.
e | expression |
tol | tolerance |
e
is within tol
of zero Definition at line 24 of file Expression.cpp.
bool tket::approx_eq | ( | double | x, |
double | y, | ||
unsigned | mod = 2 , |
||
double | tol = EPS |
||
) |
Test approximate equality of two values modulo n.
x | first value |
y | second value |
mod | modulus |
tol | tolerance |
x
is within tol
of y
modulo mod
Definition at line 35 of file Expression.cpp.
Cast a general Op
(of gate type) to a Gate
.
BadOpType | if op is not a gate. |
Definition at line 25 of file GatePtr.cpp.
unsigned long long tket::bin_to_dec | ( | const std::vector< bool > & | bin | ) |
convert an bit vector to its decimal representation big-endian
Definition at line 59 of file HelperFunctions.cpp.
Definition at line 40 of file MatrixAnalysis.cpp.
Definition at line 287 of file macro_circ_info.cpp.
const std::string & tket::c_debug_default_name | ( | ) |
Definition at line 112 of file UnitID.cpp.
const std::string & tket::c_debug_one_prefix | ( | ) |
Definition at line 106 of file UnitID.cpp.
const std::string & tket::c_debug_zero_prefix | ( | ) |
Definition at line 100 of file UnitID.cpp.
const std::string & tket::c_default_reg | ( | ) |
Definition at line 82 of file UnitID.cpp.
const std::string & tket::c_permutation_scratch_name | ( | ) |
Definition at line 118 of file UnitID.cpp.
|
delete |
Cast a coefficient to a different type.
Casting to no_coeff_t just drops the coefficient to focus on the string. Casting from no_coeff_t treats it as the scalar 1.
Casting to quarter_turns_t throws an exception if value is not in the range {1, i, -1, -i}.
Casting from Expr throws an exception if the coefficient is symbolic.
coeff | The coefficient to cast to another type. |
Complex tket::cast_coeff< Complex, Complex > | ( | const Complex & | coeff | ) |
Definition at line 166 of file PauliTensor.cpp.
Complex tket::cast_coeff< Complex, Complex > | ( | const Complex & | coeff | ) |
Definition at line 166 of file PauliTensor.cpp.
Expr tket::cast_coeff< Complex, Expr > | ( | const Complex & | coeff | ) |
Definition at line 170 of file PauliTensor.cpp.
Expr tket::cast_coeff< Complex, Expr > | ( | const Complex & | coeff | ) |
Definition at line 170 of file PauliTensor.cpp.
no_coeff_t tket::cast_coeff< Complex, no_coeff_t > | ( | const Complex & | ) |
Definition at line 147 of file PauliTensor.cpp.
no_coeff_t tket::cast_coeff< Complex, no_coeff_t > | ( | const Complex & | ) |
Definition at line 147 of file PauliTensor.cpp.
quarter_turns_t tket::cast_coeff< Complex, quarter_turns_t > | ( | const Complex & | coeff | ) |
Definition at line 151 of file PauliTensor.cpp.
quarter_turns_t tket::cast_coeff< Complex, quarter_turns_t > | ( | const Complex & | coeff | ) |
Definition at line 151 of file PauliTensor.cpp.
Complex tket::cast_coeff< Expr, Complex > | ( | const Expr & | coeff | ) |
Definition at line 188 of file PauliTensor.cpp.
Complex tket::cast_coeff< Expr, Complex > | ( | const Expr & | coeff | ) |
Definition at line 188 of file PauliTensor.cpp.
Expr tket::cast_coeff< Expr, Expr > | ( | const Expr & | coeff | ) |
Definition at line 197 of file PauliTensor.cpp.
Expr tket::cast_coeff< Expr, Expr > | ( | const Expr & | coeff | ) |
Definition at line 197 of file PauliTensor.cpp.
no_coeff_t tket::cast_coeff< Expr, no_coeff_t > | ( | const Expr & | ) |
Definition at line 175 of file PauliTensor.cpp.
no_coeff_t tket::cast_coeff< Expr, no_coeff_t > | ( | const Expr & | ) |
Definition at line 175 of file PauliTensor.cpp.
quarter_turns_t tket::cast_coeff< Expr, quarter_turns_t > | ( | const Expr & | coeff | ) |
Definition at line 179 of file PauliTensor.cpp.
quarter_turns_t tket::cast_coeff< Expr, quarter_turns_t > | ( | const Expr & | coeff | ) |
Definition at line 179 of file PauliTensor.cpp.
Complex tket::cast_coeff< no_coeff_t, Complex > | ( | const no_coeff_t & | ) |
Definition at line 94 of file PauliTensor.cpp.
Complex tket::cast_coeff< no_coeff_t, Complex > | ( | const no_coeff_t & | ) |
Definition at line 94 of file PauliTensor.cpp.
Expr tket::cast_coeff< no_coeff_t, Expr > | ( | const no_coeff_t & | ) |
Definition at line 98 of file PauliTensor.cpp.
Expr tket::cast_coeff< no_coeff_t, Expr > | ( | const no_coeff_t & | ) |
Definition at line 98 of file PauliTensor.cpp.
no_coeff_t tket::cast_coeff< no_coeff_t, no_coeff_t > | ( | const no_coeff_t & | ) |
Definition at line 86 of file PauliTensor.cpp.
no_coeff_t tket::cast_coeff< no_coeff_t, no_coeff_t > | ( | const no_coeff_t & | ) |
Definition at line 86 of file PauliTensor.cpp.
quarter_turns_t tket::cast_coeff< no_coeff_t, quarter_turns_t > | ( | const no_coeff_t & | ) |
Definition at line 90 of file PauliTensor.cpp.
quarter_turns_t tket::cast_coeff< no_coeff_t, quarter_turns_t > | ( | const no_coeff_t & | ) |
Definition at line 90 of file PauliTensor.cpp.
Complex tket::cast_coeff< quarter_turns_t, Complex > | ( | const quarter_turns_t & | coeff | ) |
Definition at line 112 of file PauliTensor.cpp.
Complex tket::cast_coeff< quarter_turns_t, Complex > | ( | const quarter_turns_t & | coeff | ) |
Definition at line 112 of file PauliTensor.cpp.
Expr tket::cast_coeff< quarter_turns_t, Expr > | ( | const quarter_turns_t & | coeff | ) |
Definition at line 129 of file PauliTensor.cpp.
Expr tket::cast_coeff< quarter_turns_t, Expr > | ( | const quarter_turns_t & | coeff | ) |
Definition at line 129 of file PauliTensor.cpp.
no_coeff_t tket::cast_coeff< quarter_turns_t, no_coeff_t > | ( | const quarter_turns_t & | ) |
Definition at line 103 of file PauliTensor.cpp.
no_coeff_t tket::cast_coeff< quarter_turns_t, no_coeff_t > | ( | const quarter_turns_t & | ) |
Definition at line 103 of file PauliTensor.cpp.
quarter_turns_t tket::cast_coeff< quarter_turns_t, quarter_turns_t > | ( | const quarter_turns_t & | coeff | ) |
Definition at line 107 of file PauliTensor.cpp.
quarter_turns_t tket::cast_coeff< quarter_turns_t, quarter_turns_t > | ( | const quarter_turns_t & | coeff | ) |
Definition at line 107 of file PauliTensor.cpp.
|
delete |
Cast between two different Pauli container types.
Casting into a type with restricted indices (e.g. DensePauliMap expecting default register qubits) may throw an exception.
cont | The Pauli container to convert to another type. |
DensePauliMap tket::cast_container< DensePauliMap, DensePauliMap > | ( | const DensePauliMap & | cont | ) |
Definition at line 80 of file PauliTensor.cpp.
DensePauliMap tket::cast_container< DensePauliMap, DensePauliMap > | ( | const DensePauliMap & | cont | ) |
Definition at line 80 of file PauliTensor.cpp.
QubitPauliMap tket::cast_container< DensePauliMap, QubitPauliMap > | ( | const DensePauliMap & | cont | ) |
Definition at line 48 of file PauliTensor.cpp.
QubitPauliMap tket::cast_container< DensePauliMap, QubitPauliMap > | ( | const DensePauliMap & | cont | ) |
Definition at line 48 of file PauliTensor.cpp.
DensePauliMap tket::cast_container< QubitPauliMap, DensePauliMap > | ( | const QubitPauliMap & | cont | ) |
Definition at line 59 of file PauliTensor.cpp.
DensePauliMap tket::cast_container< QubitPauliMap, DensePauliMap > | ( | const QubitPauliMap & | cont | ) |
Definition at line 59 of file PauliTensor.cpp.
QubitPauliMap tket::cast_container< QubitPauliMap, QubitPauliMap > | ( | const QubitPauliMap & | cont | ) |
Definition at line 42 of file PauliTensor.cpp.
QubitPauliMap tket::cast_container< QubitPauliMap, QubitPauliMap > | ( | const QubitPauliMap & | cont | ) |
Definition at line 42 of file PauliTensor.cpp.
void tket::check_easy_diagonalise | ( | std::list< SpSymPauliTensor > & | gadgets, |
std::set< Qubit > & | qubits, | ||
Circuit & | circ | ||
) |
Check whether there are any qubits which only requires a single qubit Clifford to make all Paulis I or Z.
Definition at line 24 of file Diagonalisation.cpp.
Check equality of each element of first and second when first and second can provide begin, end iterators.
Definition at line 37 of file HelperFunctions.hpp.
std::optional< std::pair< Pauli, Pauli > > tket::check_pair_compatibility | ( | const Qubit & | qb1, |
const Qubit & | qb2, | ||
const std::list< SpSymPauliTensor > & | gadgets | ||
) |
Given two qubits, attempt to find a basis in which a single CX will make the Paulis on one of qubits fully diagonal.
Definition at line 70 of file Diagonalisation.cpp.
ChoiMixTableau tket::circuit_to_cm_tableau | ( | const Circuit & | circ | ) |
Construct a ChoiMixTableau for a given circuit.
Will incorporate qubit initialisations and discarding into the circuit. Will throw an exception if it contains non-Clifford gates.
Definition at line 23 of file ChoiMixTableauConverters.cpp.
PauliGraph tket::circuit_to_pauli_graph | ( | const Circuit & | circ | ) |
Definition at line 23 of file PauliGraphConverters.cpp.
UnitaryRevTableau tket::circuit_to_unitary_rev_tableau | ( | const Circuit & | circ | ) |
Definition at line 249 of file UnitaryTableauConverters.cpp.
UnitaryTableau tket::circuit_to_unitary_tableau | ( | const Circuit & | circ | ) |
Construct the tableau for a given circuit.
Will throw an exception if it contains non-Clifford gates.
Definition at line 21 of file UnitaryTableauConverters.cpp.
std::pair< zx::ZXDiagram, boost::bimap< zx::ZXVert, Vertex > > tket::circuit_to_zx | ( | const Circuit & | circuit | ) |
Construct a zx diagram from a given circuit.
Return the zx diagram and a map between the zx boundary vertices and the circuit boundary vertices.
Definition at line 558 of file ZXConverters.cpp.
BoundaryVertMap tket::circuit_to_zx_recursive | ( | const Circuit & | circ, |
ZXDiagram & | zxd, | ||
bool | add_boundary | ||
) |
Definition at line 111 of file ZXConverters.cpp.
std::shared_ptr< ClassicalTransformOp > tket::ClassicalCX | ( | ) |
Classical CNOT transform.
Definition at line 428 of file ClassicalOps.cpp.
std::shared_ptr< ClassicalTransformOp > tket::ClassicalX | ( | ) |
Classical NOT transform.
Definition at line 421 of file ClassicalOps.cpp.
void tket::clean_frontier | ( | ZXDiagram & | diag, |
ZXVertVec & | frontier, | ||
Circuit & | circ, | ||
std::map< ZXVert, unsigned > & | qubit_map, | ||
std::map< ZXVert, ZXVert > & | input_qubits | ||
) |
Definition at line 586 of file ZXConverters.cpp.
std::pair< Circuit, qubit_map_t > tket::cm_tableau_to_exact_circuit | ( | const ChoiMixTableau & | tab, |
CXConfigType | cx_config = CXConfigType::Snake |
||
) |
Constructs a circuit producing the same effect as a ChoiMixTableau.
Since Circuit does not support distinct qubit addresses for inputs and outputs, also returns a map from the output qubit IDs in the tableau to their corresponding outputs in the circuit.
The circuit produced will be the (possibly non-unitary) channel whose stabilisers are exactly those of the tableau and no more, using initialisations, post-selections, discards, resets, and collapses to ensure this. It will automatically reuse qubits so no more qubits will be needed than max(tab.get_n_inputs(), tab.get_n_outputs()).
Example 1: ZXI -> () YYZ -> () This becomes a diagonalisation circuit followed by post-selections.
Example 2: Z -> ZZ X -> IY Z -> -XX Combining the first and last rows reveals an initialisation is required for I -> YY. Since there are two output qubits, at least one of them does not already exist in the input fragment so we can freely add an extra qubit on the input side, initialise it and apply a unitary mapping IZ -> YY.
Example 3: ZX -> IZ II -> ZI We require an initialised qubit for the final row, but both input and output spaces only have q[0] and q[1], of which both inputs need to be open for the first row. We can obtain an initialised qubit by resetting a qubit after reducing the first row to only a single qubit.
Definition at line 149 of file ChoiMixTableauConverters.cpp.
std::pair< Circuit, qubit_map_t > tket::cm_tableau_to_unitary_extension_circuit | ( | const ChoiMixTableau & | tab, |
const std::vector< Qubit > & | init_names = {} , |
||
const std::vector< Qubit > & | post_names = {} , |
||
CXConfigType | cx_config = CXConfigType::Snake |
||
) |
We define a unitary extension of a ChoiMixTableau to be a unitary circuit whose stabilizer group contain all the rows of the ChoiMixTableau and possibly more.
This is useful when we are treating the ChoiMixTableau as a means to encode a diagonalisation problem, since we are generally looking for a unitary as we may wish to apply the inverse afterwards (e.g. conjugating some rotations to implement a set of Pauli gadgets).
Not every ChoiMixTableau can be extended to a unitary by just adding rows, e.g. if it requires any initialisation or post-selections. In this case, the unitary circuit is extended with additional input qubits which are assumed to be zero-initialised, and additional output qubits which are assumed to be post-selected. The synthesis guarantees that, if we take the unitary, initialise all designated inputs, and post-select on all designated outputs, every row from the original tableau is a stabiliser for the remaining projector. When not enough additional qubit names are provided, an error is thrown.
Example 1: ZXI -> () YYZ -> () Since, in exact synthesis, at least two post-selections would be required, we pick two names from post_names. This is then a diagonalisation circuit which maps each row to an arbitrary diagonal string over post_names.
Example 2: Z -> ZZ X -> IY Z -> -XX Combining the first and last rows reveals an initialisation is required for I -> YY. We extend the inputs with a qubit from init_names. The initialisation can manifest as either altering the first row to ZZ -> ZZ or the last row to ZZ -> -XX.
Example 3: ZX -> IZ II -> ZI We require an initialised qubit for the final row, but both input and output spaces only have q[0] and q[1], of which both inputs need to be open for the first row. Unlike exact synthesis, we cannot reuse qubits, so the returned circuit will be over 3 qubits, extending with a name from init_names.
Definition at line 163 of file ChoiMixTableauConverters.cpp.
const PassPtr & tket::CnXPairwiseDecomposition | ( | ) |
Decompose CnX gates to 2-qubit gates and single qubit gates.
For every two CnX gates, reorder their control qubits to improve the chance of gate cancellation
Definition at line 437 of file PassLibrary.cpp.
Eigen::VectorXcd tket::combine_diagonals | ( | const std::vector< Eigen::VectorXcd > & | all_diags, |
unsigned | n_controls_, | ||
unsigned | n_targets_ | ||
) |
Definition at line 1050 of file Multiplexor.cpp.
std::vector< std::vector< OpTypeVector > > tket::combine_vectors | ( | const std::vector< std::vector< OpTypeVector > > & | vec_0, |
const std::vector< OpTypeVector > & | vec_1 | ||
) |
Definition at line 147 of file FrameRandomisation.cpp.
std::set< unsigned > tket::common_indices | ( | const DensePauliMap & | first, |
const DensePauliMap & | second | ||
) |
Find the set of qubits (as unsigned integer indices) on which first
and second
have the same non-trivial Pauli (X, Y, Z).
Definition at line 296 of file PauliTensor.cpp.
std::set< Qubit > tket::common_qubits | ( | const QubitPauliMap & | first, |
const QubitPauliMap & | second | ||
) |
Find the set of Qubits on which first
and second
have the same non-trivial Pauli (X, Y, Z).
Definition at line 284 of file PauliTensor.cpp.
const PassPtr & tket::CommuteThroughMultis | ( | ) |
Definition at line 102 of file PassLibrary.cpp.
|
delete |
Return whether two Pauli containers commute as Pauli strings (there are an even number of qubits on which they have distinct non-trivial Paulis).
bool tket::commuting_containers< DensePauliMap > | ( | const DensePauliMap & | first, |
const DensePauliMap & | second | ||
) |
Definition at line 363 of file PauliTensor.cpp.
bool tket::commuting_containers< DensePauliMap > | ( | const DensePauliMap & | first, |
const DensePauliMap & | second | ||
) |
Definition at line 363 of file PauliTensor.cpp.
bool tket::commuting_containers< QubitPauliMap > | ( | const QubitPauliMap & | first, |
const QubitPauliMap & | second | ||
) |
Definition at line 357 of file PauliTensor.cpp.
bool tket::commuting_containers< QubitPauliMap > | ( | const QubitPauliMap & | first, |
const QubitPauliMap & | second | ||
) |
Definition at line 357 of file PauliTensor.cpp.
|
delete |
Compare two coefficients of the same type with respect to an ordering.
All values of no_coeff_t are equal. Values of quarter_turns_t are compared modulo 4. Values of Complex are compared lexicographically by the real part and then imaginary. Non-symbolic values of Expr are compared as Complex, symbolic values are compared by the canonical form of SymEngine expressions.
first | A coefficient. |
second | Another coefficient of the same type. |
-1 | first < second |
0 | first == second |
1 | first > second |
int tket::compare_coeffs< Complex > | ( | const Complex & | first, |
const Complex & | second | ||
) |
Definition at line 266 of file PauliTensor.cpp.
int tket::compare_coeffs< Complex > | ( | const Complex & | first, |
const Complex & | second | ||
) |
Definition at line 266 of file PauliTensor.cpp.
int tket::compare_coeffs< Expr > | ( | const Expr & | first, |
const Expr & | second | ||
) |
Definition at line 273 of file PauliTensor.cpp.
int tket::compare_coeffs< Expr > | ( | const Expr & | first, |
const Expr & | second | ||
) |
Definition at line 273 of file PauliTensor.cpp.
int tket::compare_coeffs< no_coeff_t > | ( | const no_coeff_t & | , |
const no_coeff_t & | |||
) |
Definition at line 256 of file PauliTensor.cpp.
int tket::compare_coeffs< no_coeff_t > | ( | const no_coeff_t & | , |
const no_coeff_t & | |||
) |
Definition at line 256 of file PauliTensor.cpp.
int tket::compare_coeffs< quarter_turns_t > | ( | const quarter_turns_t & | first, |
const quarter_turns_t & | second | ||
) |
Definition at line 260 of file PauliTensor.cpp.
int tket::compare_coeffs< quarter_turns_t > | ( | const quarter_turns_t & | first, |
const quarter_turns_t & | second | ||
) |
Definition at line 260 of file PauliTensor.cpp.
|
delete |
Compare two Pauli containers of the same type for ordering.
Individual Paulis are ordered alphabetically as I < X < Y < Z. Strings are ordered lexicographically, IZ < ZI (Zq[1] < Zq[0]).
first | A Pauli container |
second | Another Pauli container of the same type. |
-1 | first < second |
0 | first == second |
1 | first > second |
int tket::compare_containers< DensePauliMap > | ( | const DensePauliMap & | first, |
const DensePauliMap & | second | ||
) |
Definition at line 233 of file PauliTensor.cpp.
int tket::compare_containers< DensePauliMap > | ( | const DensePauliMap & | first, |
const DensePauliMap & | second | ||
) |
Definition at line 233 of file PauliTensor.cpp.
int tket::compare_containers< QubitPauliMap > | ( | const QubitPauliMap & | first, |
const QubitPauliMap & | second | ||
) |
Definition at line 202 of file PauliTensor.cpp.
int tket::compare_containers< QubitPauliMap > | ( | const QubitPauliMap & | first, |
const QubitPauliMap & | second | ||
) |
Definition at line 202 of file PauliTensor.cpp.
PassPtr tket::ComposePhasePolyBoxes | ( | unsigned | min_size = 0 | ) |
converts a circuit containing all possible gates to a circuit containing only phase poly boxes + H gates (and measure + reset + collapse + barrier)
min_size | value for the minimal number of CX in each box, groups with less than min_size CX gates are not converted to a PhasePolyBox, default value is 0 |
converts a circuit containing all possible gates to a circuit containing only phase poly boxes + H gates (and measure + reset + collapse
Definition at line 184 of file PassLibrary.cpp.
std::set< unsigned > tket::conflicting_indices | ( | const DensePauliMap & | first, |
const DensePauliMap & | second | ||
) |
Find the set of qubits (as unsigned integer indices) on which first
and second
have distinct non-trivial Paulis (X, Y, Z).
Definition at line 344 of file PauliTensor.cpp.
std::set< Qubit > tket::conflicting_qubits | ( | const QubitPauliMap & | first, |
const QubitPauliMap & | second | ||
) |
Find the set of Qubits on which first
and second
have distinct non-trivial Paulis (X, Y, Z).
Definition at line 331 of file PauliTensor.cpp.
Captures rules for conjugating a pauli-gadget with single-qubit Clifford gates Maps gate and pauli to the new pauli after the conjugation and whether or not a phase-flip is induced.
Definition at line 23 of file ConjugatePauliFunctions.cpp.
void tket::conjugate_PauliTensor | ( | SpPauliStabiliser & | qpt, |
OpType | op, | ||
const Qubit & | q, | ||
bool | reverse | ||
) |
Methods to conjugate a SpPauliStabiliser with Clifford gates to change basis Transforms P to P' such that reverse = false : –P'– = –op–P–opdg– reverse = true : –P'– = –opdg–P–op–.
Definition at line 100 of file ConjugatePauliFunctions.cpp.
void tket::conjugate_PauliTensor | ( | SpPauliStabiliser & | qpt, |
OpType | op, | ||
const Qubit & | q0, | ||
const Qubit & | q1 | ||
) |
Definition at line 113 of file ConjugatePauliFunctions.cpp.
void tket::conjugate_PauliTensor | ( | SpPauliStabiliser & | qpt, |
OpType | op, | ||
const Qubit & | q0, | ||
const Qubit & | q1, | ||
const Qubit & | q2 | ||
) |
Definition at line 147 of file ConjugatePauliFunctions.cpp.
EdgeVec tket::convert_b_frontier_to_edges | ( | const b_frontier_t & | b_frontier | ) |
Definition at line 501 of file MappingFrontier.cpp.
EdgeVec tket::convert_u_frontier_to_edges | ( | const unit_frontier_t & | u_frontier | ) |
convert_u_frontier_to_edges Subcircuit requires EdgeVec, not unit_frontier_t as boundary information Helper Functions to convert types
Definition at line 493 of file MappingFrontier.cpp.
Return cos(e*pi/2)
If e is within EPS
of an integer then it is rounded so that the result can be evaluated.
Definition at line 106 of file Expression.cpp.
csd_t tket::CS_decomp | ( | const Eigen::MatrixXcd & | u | ) |
Compute a cosine-sine decomposition of a unitary matrix.
u | unitary matrix to be decomposed |
u
has even dimensions Definition at line 25 of file CosSinDecomposition.cpp.
PassPtr tket::CustomPass | ( | std::function< Circuit(const Circuit &)> | transform, |
const std::string & | label = "" |
||
) |
Generate a custom pass.
transform | circuit transformation function |
label | optional user-defined label for the pass |
It is the caller's responsibility to provide a valid transform: there are no checks on this.
Definition at line 1171 of file PassGenerators.cpp.
PassPtr tket::CustomPassMap | ( | std::function< std::pair< Circuit, std::pair< unit_map_t, unit_map_t > >(const Circuit &)> | transform, |
const std::string & | label = "" |
||
) |
Generate a custom pass that tracks map.
transform | circuit transformation function and modified intial and final maps |
label | optional user-defined label for the pass |
It is the caller's responsibility to provide a valid transform: there are no checks on this.
Definition at line 1189 of file PassGenerators.cpp.
Replace a multi-qubit operation with an equivalent circuit using CX gates.
op | operation |
op
is a multi-qubit operationDefinition at line 114 of file Replacement.cpp.
Replace an operation with an equivalent circuit using CX, Rx and Rz.
op | operation |
Definition at line 132 of file Replacement.cpp.
|
constexpr |
Complex zero.
std::vector< bool > tket::dec_to_bin | ( | unsigned long long | dec, |
unsigned | width | ||
) |
convert an unsigned to its binary representation big-endian
Definition at line 49 of file HelperFunctions.cpp.
Decompose a unitary matrix into a 2-CXs preceding a diagonal operator.
Given an arbitrary unitary 4x4 matrix, this method returns a circuit C and a complex number z such that |z|=1 and U = DV where V is the unitary implemented by the circuit and D = diag(z, z*, z*, z). The circuit C consists of CX and single-qubit gates and has at most 2 CX gates.
U | unitary matrix |
Definition at line 262 of file CircUtils.cpp.
Decompose a unitary matrix into a 2-CX circuit following a diagonal operator.
Given an arbitrary unitary 4x4 matrix, this method returns a circuit C and a complex number z such that |z|=1 and U = VD where V is the unitary implemented by the circuit and D = diag(z, z*, z*, z). The circuit C consists of CX and single-qubit gates and has at most 2 CX gates.
U | unitary matrix |
Definition at line 255 of file CircUtils.cpp.
const PassPtr & tket::DecomposeArbitrarilyControlledGates | ( | ) |
Definition at line 115 of file PassLibrary.cpp.
PassPtr tket::DecomposeBoxes | ( | const std::unordered_set< OpType > & | excluded_types = {} , |
const std::unordered_set< std::string > & | excluded_opgroups = {} , |
||
const std::optional< std::unordered_set< OpType > > & | included_types = std::nullopt , |
||
const std::optional< std::unordered_set< std::string > > & | included_opgroups = std::nullopt |
||
) |
Recursively replaces all boxes by their decomposition using Box::to_circuit.
excluded_types | box types excluded from decomposition |
excluded_opgroups | opgroups excluded from decomposition |
included_types | optional, only decompose these box types |
included_opgroups | optional, only decompose these opgroups |
Preserves Max2QubitGatesPredicate since any box with >2 qubits is already invalid. Preserves ConnectivityPredicate (and DirectednessPredicate) since the verification looks inside CircBoxes and any other boxes with >2 qubits are already invalid. Most others are preserved since the predicates look within CircBoxes.
Invalidates GateSetPredicate because it doesn't look inside boxes or account for the gate set of their decomposition.
Definition at line 215 of file PassLibrary.cpp.
const PassPtr & tket::DecomposeBridges | ( | ) |
Definition at line 263 of file PassLibrary.cpp.
const PassPtr & tket::DecomposeMultiQubitsCX | ( | ) |
Definition at line 130 of file PassLibrary.cpp.
const PassPtr & tket::DecomposeSingleQubitsTK1 | ( | ) |
Definition at line 159 of file PassLibrary.cpp.
PassPtr tket::DecomposeTK2 | ( | bool | allow_swaps | ) |
Definition at line 830 of file PassGenerators.cpp.
PassPtr tket::DecomposeTK2 | ( | const Transforms::TwoQbFidelities & | fid, |
bool | allow_swaps = true |
||
) |
Decomposes each TK2 gate into two-qubit gates.
We currently support CX, ZZMax and ZZPhase.
If one or more gate fidelities are provided, the two-qubit gate type achieving the highest fidelity will be chosen for the decomposition, as measured using squared trace fidelity. If no fidelities are provided, the TK2 gates will be decomposed exactly using CX gates.
All TK2(α, β, γ) gates must be normalised to the Weyl chamber, i.e. 0.5 ≥ 𝛼 ≥ 𝛽 ≥ |𝛾|.
Gate fidelities are passed as keyword arguments to perform noise-aware decompositions. We currently support CX_fidelity
, ZZMax_fidelity
and ZZPhase_fidelity
. If provided, the CX
and ZZMax
fidelities must be given by a single floating point fidelity. The ZZPhase
fidelity is given as a lambda float -> float, mapping a ZZPhase angle parameter to its fidelity. These parameters will be used to return the optimal decomposition of each TK2 gate, taking noise into consideration.
Using the allow_swaps=true
(default) option, qubits will be swapped when convenient to reduce the two-qubit gate count of the decomposed TK2.
If the TK2 angles are symbolic values, the decomposition will be exact (i.e. not noise-aware). It is not possible in general to obtain optimal decompositions for arbitrary symbolic parameters, so consider substituting for concrete values if possible.
fid | The two-qubit gate fidelities (optional). |
allow_swaps | Allow implicit swaps (default = true). |
Definition at line 831 of file PassGenerators.cpp.
|
delete |
Other options for scalar coefficients include:
Complex; floating-point complex number. Mostly used by the python binder to present a phaseful interface with guaranteed success on converting to a sparse matrix.
Expr; a symbolic expression for a (possibly complex) coefficient. This tends to be used in the context of Pauli exponentials of tracking the rotation angle (along with its phase), where such synthesis functions map cP to exp(i*cP*pi/2) (i.e. the coefficient is the angle of rotation in half-turns). Returns the default coefficient value (scalar 1) for each coefficient type.
{} | (no_coeff_t) |
0 | (quarter_turns_t) |
1. | (Complex) |
1 | (Expr) |
Complex tket::default_coeff< Complex > | ( | ) |
Definition at line 33 of file PauliTensor.cpp.
Complex tket::default_coeff< Complex > | ( | ) |
Definition at line 33 of file PauliTensor.cpp.
Expr tket::default_coeff< Expr > | ( | ) |
Definition at line 37 of file PauliTensor.cpp.
Expr tket::default_coeff< Expr > | ( | ) |
Definition at line 37 of file PauliTensor.cpp.
no_coeff_t tket::default_coeff< no_coeff_t > | ( | ) |
Definition at line 25 of file PauliTensor.cpp.
no_coeff_t tket::default_coeff< no_coeff_t > | ( | ) |
Definition at line 25 of file PauliTensor.cpp.
quarter_turns_t tket::default_coeff< quarter_turns_t > | ( | ) |
Definition at line 29 of file PauliTensor.cpp.
quarter_turns_t tket::default_coeff< quarter_turns_t > | ( | ) |
Definition at line 29 of file PauliTensor.cpp.
const PassPtr & tket::DelayMeasures | ( | bool | allow_partial = false | ) |
Commutes measurements to the end of the circuit.
allow_partial | Whether to allow measurements that cannot be commuted to the end, and delay them as much as possible instead. If false, the pass includes a CommutableMeasuresPredicate precondition. |
Definition at line 328 of file PassLibrary.cpp.
PassPtr tket::deserialise | ( | const nlohmann::json & | j, |
const std::map< std::string, std::function< Circuit(const Circuit &)> > & | custom_deserialise, | ||
const std::map< std::string, std::function< std::pair< Circuit, std::pair< unit_map_t, unit_map_t > >(const Circuit &)> > & | custom_map_deserialise | ||
) |
Definition at line 365 of file CompilerPass.cpp.
std::pair< ctrl_op_map_t, Eigen::VectorXcd > tket::disentangle_final_qubit_from_diagonal | ( | const Eigen::VectorXcd & | full_diag, |
unsigned | n_controls_ | ||
) |
Definition at line 961 of file Multiplexor.cpp.
Test whether a expression is approximately 0 modulo n.
e | expression |
n | modulus |
tol | tolerance |
true | e is within tol of 0 modulo n |
false | expression is not within tolerance or could not be evaluated |
Definition at line 142 of file Expression.cpp.
Test whether an expression is approximately a Clifford angle (some multiple of 0.5 modulo n)
e | expression |
n | modulus |
tol | tolerance |
nullopt | expression is not within tolerance or could not be evaluated |
u | \( e \approx \frac12 u \pmod n \) where \( 0 \leq u < 2n \} \). |
Definition at line 146 of file Expression.cpp.
Test approximate equality of expressions modulo n.
e0 | expression |
e1 | expression |
n | modulus |
tol | tolerance |
true | e0 and e1 are within tol of each other modulo n |
false | expressions are not within tolerance or could not ve evaluated |
Definition at line 129 of file Expression.cpp.
Test approximate value of an expression modulo n.
e | expression |
x | test value |
n | modulus |
tol | tolerance |
true | e is within tol of x modulo n |
false | expression is not within tolerance or could not be evaluated |
Definition at line 136 of file Expression.cpp.
std::optional< double > tket::eval_expr | ( | const Expr & | e | ) |
Definition at line 58 of file Expression.cpp.
Definition at line 70 of file Expression.cpp.
std::optional< double > tket::eval_expr_mod | ( | const Expr & | e, |
unsigned | n = 2 |
||
) |
Evaluate an expression modulo n.
The result will be in the half-interval [0,n). If it is within EPS of a multiple of 0.25 the result is clamped to an exact multiple.
e | expression to evaluate |
n | modulus |
Definition at line 78 of file Expression.cpp.
Set of all free symbols contained in the expression.
Definition at line 40 of file Expression.cpp.
Set of all free symbols contained in the expressions in the vector.
Definition at line 48 of file Expression.cpp.
void tket::extend_if_input | ( | ZXDiagram & | diag, |
const ZXVert & | v, | ||
std::map< ZXVert, ZXVert > & | input_qubits | ||
) |
Definition at line 697 of file ZXConverters.cpp.
void tket::fill_partial_mapping | ( | const qubit_vector_t & | current_qubits, |
std::map< Qubit, Node > & | partial_mapping | ||
) |
Definition at line 25 of file Placement.cpp.
Whether a given operation type belongs to a given set.
Definition at line 23 of file OpTypeFunctions.cpp.
const PassPtr & tket::FlattenRegisters | ( | ) |
Definition at line 278 of file PassLibrary.cpp.
double tket::fmodn | ( | double | x, |
unsigned | n | ||
) |
Evaluate modulo n in the range [0,n)
x | value to be reduced |
n | modulus |
Definition at line 29 of file Expression.cpp.
void tket::from_json | ( | const nlohmann::json & | , |
no_coeff_t & | |||
) |
Definition at line 22 of file PauliTensor.cpp.
void tket::from_json | ( | const nlohmann::json & | , |
RoutingMethod & | rm | ||
) |
Definition at line 28 of file RoutingMethodJson.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
Architecture & | ar | ||
) |
Definition at line 231 of file Architecture.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
Architecture::Connection & | link | ||
) |
Definition at line 209 of file Architecture.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
Bit & | cb | ||
) |
Definition at line 38 of file UnitID.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
ChoiMixTableau & | tab | ||
) |
Definition at line 709 of file ChoiMixTableau.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
ChoiMixTableau::TableauSegment & | seg | ||
) |
Definition at line 694 of file ChoiMixTableau.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
Circuit & | circ | ||
) |
Definition at line 46 of file CircuitJson.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
ClExpr & | expr | ||
) |
Definition at line 260 of file ClExpr.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
ClExprArg & | arg | ||
) |
Definition at line 188 of file ClExpr.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
ClExprTerm & | term | ||
) |
Definition at line 156 of file ClExpr.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
ClExprVar & | var | ||
) |
Definition at line 124 of file ClExpr.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
Command & | com | ||
) |
Definition at line 65 of file CommandJson.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
composite_def_ptr_t & | cdef | ||
) |
void tket::from_json | ( | const nlohmann::json & | j, |
DeviceCharacterisation & | dc | ||
) |
Definition at line 105 of file DeviceCharacterisation.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
FullyConnected & | ar | ||
) |
Definition at line 249 of file Architecture.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
MeasurementSetup & | setup | ||
) |
Definition at line 147 of file MeasurementSetup.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
MeasurementSetup::MeasurementBitMap & | result | ||
) |
Definition at line 112 of file MeasurementSetup.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
Node & | node | ||
) |
Definition at line 46 of file UnitID.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
Op_ptr & | op | ||
) |
Definition at line 28 of file OpJson.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
OpType & | type | ||
) |
Definition at line 42 of file OpTypeJson.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
PauliTensor< PauliContainer, CoeffType > & | tensor | ||
) |
Definition at line 1030 of file PauliTensor.hpp.
void tket::from_json | ( | const nlohmann::json & | j, |
Placement::Ptr & | placement_ptr | ||
) |
Definition at line 155 of file Placement.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
PredicatePtr & | pred_ptr | ||
) |
Definition at line 769 of file Predicates.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
Qubit & | qb | ||
) |
Definition at line 35 of file UnitID.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
qubit_map_t & | qm | ||
) |
Definition at line 56 of file UnitID.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
ResourceBounds< T > & | bounds | ||
) |
Definition at line 53 of file ResourceData.hpp.
void tket::from_json | ( | const nlohmann::json & | j, |
ResourceData & | data | ||
) |
Definition at line 32 of file ResourceData.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
std::vector< RoutingMethodPtr > & | rmp_v | ||
) |
Definition at line 38 of file RoutingMethodJson.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
SymplecticTableau & | tab | ||
) |
Definition at line 429 of file SymplecticTableau.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
UnitaryRevTableau & | tab | ||
) |
Definition at line 739 of file UnitaryTableau.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
UnitaryTableau & | tab | ||
) |
Definition at line 521 of file UnitaryTableau.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
WasmState & | wb | ||
) |
Definition at line 41 of file UnitID.cpp.
void tket::from_json | ( | const nlohmann::json & | j, |
WiredClExpr & | expr | ||
) |
Definition at line 409 of file ClExpr.cpp.
std::shared_ptr< unit_frontier_t > tket::frontier_convert_vertport_to_edge | ( | const Circuit & | circuit, |
const std::shared_ptr< unit_vertport_frontier_t > & | u_frontier | ||
) |
linear_boundary stored as vertport so that correct edge can be recovered after subcircuit substitution method uses Vertex and port_t and Circuit::get_nth_out_edge to generate unit_frontier_t object
Definition at line 87 of file MappingFrontier.cpp.
PassPtr tket::FullPeepholeOptimise | ( | bool | allow_swaps = true , |
OpType | target_2qb_gate = OpType::CX |
||
) |
Performs peephole optimisation including resynthesis of 2- and 3-qubit gate sequences, and converts to a circuit containing a given 2-qubit gate and TK1 gates.
target_2qb_gate | target 2-qubit gate (CX or TK2) |
allow_swaps | whether to allow introduction of implicit swaps |
Definition at line 905 of file PassGenerators.cpp.
std::vector< std::pair< unsigned, unsigned > > tket::gaussian_elimination_col_ops | ( | const MatrixXb & | a, |
unsigned | blocksize | ||
) |
Definition at line 69 of file MatrixAnalysis.cpp.
std::vector< std::pair< unsigned, unsigned > > tket::gaussian_elimination_row_ops | ( | const MatrixXb & | a, |
unsigned | blocksize | ||
) |
Definition at line 93 of file MatrixAnalysis.cpp.
Attempt to generate a rebase pass automatically for the given target gateset.
allowed_gates | target gateset |
allow_swaps | whether to allow implicit wire swaps |
Definition at line 220 of file PassGenerators.cpp.
Attempt to generate a squash pass automatically for the given target single qubit gateset.
singleqs |
Definition at line 267 of file PassGenerators.cpp.
PassPtr tket::gen_clifford_push_through_pass | ( | ) |
Pass that simplifies circuits by resynthesising Clifford subcircuits before end of circuit measurements as a mutual diagonalisation circuit and classical postprocessing.
Definition at line 339 of file PassGenerators.cpp.
PassPtr tket::gen_clifford_resynthesis_pass | ( | std::optional< std::function< Circuit(const Circuit &)> > | transform = std::nullopt , |
bool | allow_swaps = true |
||
) |
Pass to resynthesise Clifford subcircuits and simplify using Clifford rules.
transform | optional user-provided resynthesis method to apply to all Clifford subcircuits (a function taking a Clifford circuit as an argument and returning an equivalent circuit); if not provided, a default resynthesis method is applied |
allow_swaps | whether the rewriting may introduce wire swaps (only relevant to the default resynthesis method used when the transform argument is not provided) |
Definition at line 328 of file PassGenerators.cpp.
Definition at line 307 of file PassGenerators.cpp.
PassPtr tket::gen_contextual_pass | ( | Transforms::AllowClassical | allow_classical = Transforms::AllowClassical::Yes , |
std::shared_ptr< const Circuit > | xcirc = 0 |
||
) |
Generate a pass to perform simplifications dependent on qubit state.
allow_classical | allow insertion of classical operations |
xcirc | 1-qubit circuit implementing an X gate (if null, an X gate is used) |
Definition at line 1143 of file PassGenerators.cpp.
PassPtr tket::gen_cx_mapping_pass | ( | const Architecture & | arc, |
const Placement::Ptr & | placement_ptr, | ||
const std::vector< RoutingMethodPtr > & | config, | ||
bool | directed_cx, | ||
bool | delay_measures | ||
) |
Definition at line 479 of file PassGenerators.cpp.
PassPtr tket::gen_decompose_routing_gates_to_cxs_pass | ( | const Architecture & | arc, |
bool | directed | ||
) |
Definition at line 767 of file PassGenerators.cpp.
PassPtr tket::gen_default_mapping_pass | ( | const Architecture & | arc, |
bool | delay_measures | ||
) |
Definition at line 468 of file PassGenerators.cpp.
PassPtr tket::gen_directed_cx_routing_pass | ( | const Architecture & | arc, |
const std::vector< RoutingMethodPtr > & | config | ||
) |
Definition at line 756 of file PassGenerators.cpp.
Definition at line 293 of file PassGenerators.cpp.
PassPtr tket::gen_flatten_relabel_registers_pass | ( | const std::string & | label | ) |
Pass to remove empty Quantum edges from a Circuit and then relabel all Qubit to some new register defined by a passed label.
Qubits removed from the Circuit are preserved in the bimap, but not updated to a new labelling.
Definition at line 356 of file PassGenerators.cpp.
PassPtr tket::gen_full_mapping_pass | ( | const Architecture & | arc, |
const Placement::Ptr & | placement_ptr, | ||
const std::vector< RoutingMethodPtr > & | config | ||
) |
Definition at line 459 of file PassGenerators.cpp.
PassPtr tket::gen_full_mapping_pass_phase_poly | ( | const Architecture & | arc, |
const unsigned | lookahead = 1 , |
||
const aas::CNotSynthType | cnotsynthtype = aas::CNotSynthType::Rec , |
||
unsigned | graph_placement_maximum_matches = 2000 , |
||
unsigned | graph_placement_timeout = 100 , |
||
unsigned | graph_placement_maximum_pattern_gates = 2000 , |
||
unsigned | graph_placement_maximum_pattern_depth = 2000 |
||
) |
execute architecture aware synthesis on a given architecture for any circuit.
all unplaced qubits will be placed in this pass
arc | architecture to route on |
lookahead | parameter for the recursion depth in the algorithm, the value should be > 0 |
cnotsynthtype | parameter for the type of cnot synth |
graph_placement_maximum_matches | parameter effecting the number of matches found during the GraphPlacement substep |
graph_placement_timeout | timeout (ms) for finding subgraph monomorphisms during the GraphPlacement substep |
graph_placement_maximum_pattern_gates | parameter affecting the size of the target graph, constructed from a phase polynomial, during the GraphPlacement substep, by restricting the number of gates in the phase polynomial used |
graph_placement_maximum_pattern_depth | parameter affecting the size of the target graph, constructed from a phase polynomial, during the GraphPlacement substep, by restricting the depth of gates in the phase polynomial that are added to the target graph |
Definition at line 742 of file PassGenerators.cpp.
GrayCode tket::gen_graycode | ( | unsigned | n | ) |
Construct a GrayCode over n
bits.
n | bits |
Definition at line 21 of file HelperFunctions.cpp.
PassPtr tket::gen_greedy_pauli_simp | ( | double | discount_rate = 0.7 , |
double | depth_weight = 0.3 , |
||
unsigned | max_lookahead = 500 , |
||
unsigned | max_tqe_candidates = 500 , |
||
unsigned | seed = 0 , |
||
bool | allow_zzphase = false , |
||
unsigned | thread_timeout = 100 , |
||
bool | only_reduce = false , |
||
unsigned | trials = 1 |
||
) |
Greedy synthesis for Pauli graphs.
discount_rate | |
depth_weight | |
max_lookahead | |
max_tqe_candidates | |
seed | |
allow_zzphase | |
thread_timeout | |
only_reduce | |
trials |
Definition at line 1014 of file PassGenerators.cpp.
PassPtr tket::gen_naive_placement_pass | ( | const Architecture & | arc | ) |
Definition at line 438 of file PassGenerators.cpp.
PassPtr tket::gen_optimise_phase_gadgets | ( | CXConfigType | cx_config | ) |
Definition at line 929 of file PassGenerators.cpp.
PassPtr tket::gen_pairwise_pauli_gadgets | ( | CXConfigType | cx_config | ) |
Definition at line 952 of file PassGenerators.cpp.
PassPtr tket::gen_pauli_exponentials | ( | Transforms::PauliSynthStrat | strat, |
CXConfigType | cx_config | ||
) |
Definition at line 974 of file PassGenerators.cpp.
PassPtr tket::gen_placement_pass | ( | const Placement::Ptr & | placement_ptr | ) |
Definition at line 401 of file PassGenerators.cpp.
PassPtr tket::gen_placement_pass_phase_poly | ( | const Architecture & | arc, |
unsigned | _maximum_matches = 2000 , |
||
unsigned | _timeout = 100 , |
||
unsigned | _maximum_pattern_gates = 100 , |
||
unsigned | _maximum_pattern_depth = 100 |
||
) |
pass to place all not yet placed qubits of the circuit to the given architecture for the architecture aware synthesis.
arc | achitecture to place the circuit on |
_maximum_matches | parameter effecting the number of matches found during the GraphPlacement substep |
_timeout | timeout (ms) for finding subgraph monomorphisms during the GraphPlacement substep |
_maximum_pattern_gates | parameter effecting the size of the target graph, constructed from a phase polynomial, during the GraphPlacement substep, by restricting the number of gates in the phase polynomial used |
_maximum_pattern_depth | parameter effecting the size of the target graph, constructed from a phase polynomial, during the GraphPlacement substep, by restricting the depth of gates in the phase polynomial that are added to the target graph |
Definition at line 574 of file PassGenerators.cpp.
PassPtr tket::gen_rebase_pass | ( | const OpTypeSet & | allowed_gates, |
const Circuit & | cx_replacement, | ||
const std::function< Circuit(const Expr &, const Expr &, const Expr &)> & | tk1_replacement | ||
) |
Definition at line 51 of file PassGenerators.cpp.
PassPtr tket::gen_rebase_pass_via_tk2 | ( | const OpTypeSet & | allowed_gates, |
const std::function< Circuit(const Expr &, const Expr &, const Expr &)> & | tk2_replacement, | ||
const std::function< Circuit(const Expr &, const Expr &, const Expr &)> & | tk1_replacement | ||
) |
Generate a rebase pass give standard replacements for TK1 and TK2 gates.
[in] | allowed_gates | set of target gates |
[in] | tk2_replacement | circuit to replace a given TK2 gate |
[in] | tk1_replacement | circuit to replace a given TK1 gate |
Definition at line 81 of file PassGenerators.cpp.
Pass to rename some or all qubits according to the given map.
Qubits in the map that do not occur in the circuit are ignored.
Definition at line 381 of file PassGenerators.cpp.
PassPtr tket::gen_routing_pass | ( | const Architecture & | arc, |
const std::vector< RoutingMethodPtr > & | config | ||
) |
Definition at line 535 of file PassGenerators.cpp.
PassPtr tket::gen_simplify_initial | ( | Transforms::AllowClassical | allow_classical = Transforms::AllowClassical::Yes , |
Transforms::CreateAllQubits | create_all_qubits = Transforms::CreateAllQubits::No , |
||
std::shared_ptr< const Circuit > | xcirc = 0 |
||
) |
Generate a pass to simplify the circuit where it acts on known basis states.
allow_classical | allow replacement of measures by pure classical set- bit operations when the measure acts on a known state |
create_all_qubits | if enabled, annotate all qubits as initialized to zero as part of the transform, before applying simplification |
xcirc | 1-qubit circuit implementing an X gate (if null, an X gate is used) |
Definition at line 1119 of file PassGenerators.cpp.
PassPtr tket::gen_special_UCC_synthesis | ( | Transforms::PauliSynthStrat | strat, |
CXConfigType | cx_config | ||
) |
Definition at line 1100 of file PassGenerators.cpp.
PassPtr tket::gen_squash_pass | ( | const OpTypeSet & | singleqs, |
const std::function< Circuit(const Expr &, const Expr &, const Expr &)> & | tk1_replacement, | ||
bool | always_squash_symbols | ||
) |
Definition at line 114 of file PassGenerators.cpp.
PassPtr tket::gen_synthesise_pauli_graph | ( | Transforms::PauliSynthStrat | strat, |
CXConfigType | cx_config | ||
) |
Definition at line 1007 of file PassGenerators.cpp.
Definition at line 796 of file PassGenerators.cpp.
Eigen::MatrixXcd tket::get_3q_unitary | ( | const Circuit & | c | ) |
Convert a 3-qubit circuit to its corresponding unitary matrix.
c | pure quantum circuit with 3 qubits |
c
is composed of 1- and 2-qubit gates only c
has no symbolic parametersDefinition at line 491 of file ThreeQubitConversion.cpp.
std::vector< std::vector< OpTypeVector > > tket::get_all_frame_permutations | ( | const unsigned & | max_frame_size, |
const OpTypeSet & | frame_types | ||
) |
Definition at line 121 of file FrameRandomisation.cpp.
std::vector< std::vector< OpTypeVector > > tket::get_all_permutation_combinations | ( | const std::vector< unsigned > & | frame_sizes, |
const std::vector< std::vector< OpTypeVector > > & | frame_permutations | ||
) |
Definition at line 162 of file FrameRandomisation.cpp.
Circuit tket::get_bitstring_circuit | ( | const std::vector< bool > & | bitstring, |
const unsigned & | target, | ||
const unsigned & | n_qubits | ||
) |
Definition at line 590 of file ToffoliBox.cpp.
std::tuple< double, double, double > tket::get_bloch_coordinate_from_state | ( | const Complex & | a, |
const Complex & | b | ||
) |
Get the bloch sphere coordinate of a 1-qubit state.
|psi> = a|0> + b|1> = e^(i phase pi)(cos(theta pi/2)|0> + e^(i phi pi)sin(theta pi/2)|1>)
a | |
b |
Definition at line 484 of file Rotation.cpp.
std::pair< std::vector< unsigned >, unsigned > tket::get_frame_sizes | ( | const std::vector< Cycle > & | cycles | ) |
Definition at line 394 of file FrameRandomisation.cpp.
std::tuple< Eigen::Matrix4cd, std::array< double, 3 >, Eigen::Matrix4cd > tket::get_information_content | ( | const Eigen::Matrix4cd & | X | ) |
Performs KAK decomposition.
Given a unitary \( X \), returns \( (K_1, (k_\mathrm{XX},k_\mathrm{YY},k_\mathrm{ZZ}, K_2) \) such that \( X = K_1 \cdot \exp(-\frac12 i \pi \sum_{w \in \{\mathrm{XX}, \mathrm{YY}, \mathrm{ZZ}\}} k_w \sigma_w) \cdot K_2 \). The \( k_w \) are called information content and partition \( \mathrm{SU}(4) \) into equivalence classes modulo local transformations.
See arXiv quant-ph/0507171 for details
X | unitary 4x4 matrix |
Definition at line 305 of file MatrixAnalysis.cpp.
Convert a vertex holding a TK1 operation to its corresponding matrix.
circ | circuit |
vert | vertex in circuit |
vert
is an operation of OpType::TK1 Definition at line 37 of file CircUtils.cpp.
Eigen::Matrix4cd tket::get_matrix_from_2qb_circ | ( | const Circuit & | circ | ) |
Convert a two-qubit circuit to its corresponding matrix.
circ | circuit |
circ
is composed of CX, TK2 and single-qubit gates only Definition at line 63 of file CircUtils.cpp.
Eigen::Matrix2cd tket::get_matrix_from_circ | ( | const Circuit & | circ | ) |
Convert a one-qubit circuit of TK1 operations to its corresponding matrix.
circ | circuit |
Definition at line 47 of file CircUtils.cpp.
Eigen::Matrix2cd tket::get_matrix_from_tk1_angles | ( | std::vector< Expr > | params | ) |
Construct matrix from TK1 angles and phase.
params | [a,b,c,t] where a,b,c are the TK1 angles and t is the phase |
Definition at line 504 of file Rotation.cpp.
unsigned tket::get_matrix_size | ( | unsigned | number_of_qubits | ) |
Returns 2^n, but throws if n is too large (causes overflow).
(Warning: simply taking 1<<n and testing against zero can give incorrect results with large n).
Definition at line 438 of file MatrixAnalysis.cpp.
const std::map< std::pair< Pauli, Pauli >, std::pair< quarter_turns_t, Pauli > > & tket::get_mult_matrix | ( | ) |
Returns a const reference to a lookup table for multiplying individual Paulis.
Maps {p0, p1} -> {k, p2} where p0*p1 = e^{i*k*pi/2}*p2, e.g. {Pauli::X, Pauli::Y} -> {1, Pauli::Z} (X*Y = iZ).
Definition at line 530 of file PauliTensor.cpp.
unsigned tket::get_number_of_qubits | ( | unsigned | matrix_size | ) |
We have a matrix size, which should be 2^n.
Return n, or throw if invalid.
Definition at line 452 of file MatrixAnalysis.cpp.
Get an operation with a given type, single parameter and qubit count.
chosen_type | operation type |
param | operation parameter |
n_qubits | number of qubits (only necessary for gates, barrier and metaops with variable quantum arity) |
Definition at line 25 of file OpPtrFunctions.cpp.
Op_ptr tket::get_op_ptr | ( | OpType | chosen_type, |
const std::vector< Expr > & | params = {} , |
||
unsigned | n_qubits = 0 |
||
) |
Get an operation from a type, vector of parameters and qubit count.
chosen_type | operation type |
params | operation parameters |
n_qubits | number of qubits (only necessary for gates, barrier and metaops with variable quantum arity) |
Definition at line 29 of file OpPtrFunctions.cpp.
SparseMatrixXcd tket::get_sparse_matrix | ( | const std::vector< TripletCd > & | triplets, |
unsigned | rows, | ||
unsigned | cols | ||
) |
Definition at line 463 of file MatrixAnalysis.cpp.
SparseMatrixXcd tket::get_sparse_square_matrix | ( | const std::vector< TripletCd > & | triplets, |
unsigned | rows | ||
) |
Definition at line 470 of file MatrixAnalysis.cpp.
std::vector< TripletCd > tket::get_triplets | ( | const Eigen::MatrixXcd & | matr, |
double | abs_epsilon = EPS |
||
) |
Convert a matrix M into a list of tuples (i,j,z), meaning that M(i,j)=z, used in sparse representations of M.
matr | The dense matrix. |
abs_epsilon | If std::abs(z) <= abs_epsilon, then z is so small that it is treated as zero exactly and hence not added to the list of triplets. |
Definition at line 490 of file MatrixAnalysis.cpp.
std::vector< TripletCd > tket::get_triplets | ( | const SparseMatrixXcd & | matr, |
double | abs_epsilon = EPS |
||
) |
abs_epsilon is used to decide if a near-zero entry should be set to zero exactly.
Thus, if std::abs(z) <= abs_epsilon, then z is treated as zero.
Definition at line 475 of file MatrixAnalysis.cpp.
UnitID tket::get_unitid_from_unit_frontier | ( | const std::shared_ptr< unit_vertport_frontier_t > & | u_frontier, |
const VertPort & | vp | ||
) |
unit_vertport_frontier_t is <UnitID, VertPort>, helper function returns UnitID corresponding to given VertPort
Definition at line 51 of file MappingFrontier.cpp.
std::vector< boost::bimap< Qubit, Node > > tket::get_weighted_subgraph_monomorphisms | ( | QubitGraph::UndirectedConnGraph & | pattern_graph, |
Architecture::UndirectedConnGraph & | target_graph, | ||
unsigned | max_matches, | ||
unsigned | timeout_ms, | ||
bool | return_best | ||
) |
Solves the pure unweighted subgraph monomorphism problem, trying to embed the pattern graph into the target graph.
Note that graph edge weights are IGNORED by this function.
Circuit tket::gray_synth | ( | unsigned | n_qubits, |
const std::list< phase_term_t > & | parities, | ||
const MatrixXb & | linear_transformation | ||
) |
Definition at line 90 of file PhasePoly.cpp.
void tket::greedy_diagonalise | ( | const std::list< SpSymPauliTensor > & | gadgets, |
std::set< Qubit > & | qubits, | ||
Conjugations & | conjugations, | ||
Circuit & | circ, | ||
CXConfigType | cx_config | ||
) |
Diagonalise a qubit greedily by finding the Pauli Gadget with the lowest residual support over the non-diagonal qubits, and apply single qubit Cliffords and CXs to make it a ZIII...I
string.
Definition at line 106 of file Diagonalisation.cpp.
|
delete |
Hash a coefficient, combining it with an existing hash of another structure.
void tket::hash_combine_coeff< Complex > | ( | std::size_t & | seed, |
const Complex & | coeff | ||
) |
Definition at line 502 of file PauliTensor.cpp.
void tket::hash_combine_coeff< Complex > | ( | std::size_t & | seed, |
const Complex & | coeff | ||
) |
Definition at line 502 of file PauliTensor.cpp.
void tket::hash_combine_coeff< Expr > | ( | std::size_t & | seed, |
const Expr & | coeff | ||
) |
Definition at line 507 of file PauliTensor.cpp.
void tket::hash_combine_coeff< Expr > | ( | std::size_t & | seed, |
const Expr & | coeff | ||
) |
Definition at line 507 of file PauliTensor.cpp.
void tket::hash_combine_coeff< no_coeff_t > | ( | std::size_t & | , |
const no_coeff_t & | |||
) |
Definition at line 493 of file PauliTensor.cpp.
void tket::hash_combine_coeff< no_coeff_t > | ( | std::size_t & | , |
const no_coeff_t & | |||
) |
Definition at line 493 of file PauliTensor.cpp.
void tket::hash_combine_coeff< quarter_turns_t > | ( | std::size_t & | seed, |
const quarter_turns_t & | coeff | ||
) |
Definition at line 496 of file PauliTensor.cpp.
void tket::hash_combine_coeff< quarter_turns_t > | ( | std::size_t & | seed, |
const quarter_turns_t & | coeff | ||
) |
Definition at line 496 of file PauliTensor.cpp.
|
delete |
Hash a Pauli container, combining it with an existing hash of another structure.
void tket::hash_combine_paulis< DensePauliMap > | ( | std::size_t & | seed, |
const DensePauliMap & | paulis | ||
) |
Definition at line 480 of file PauliTensor.cpp.
void tket::hash_combine_paulis< DensePauliMap > | ( | std::size_t & | seed, |
const DensePauliMap & | paulis | ||
) |
Definition at line 480 of file PauliTensor.cpp.
void tket::hash_combine_paulis< QubitPauliMap > | ( | std::size_t & | seed, |
const QubitPauliMap & | paulis | ||
) |
Definition at line 469 of file PauliTensor.cpp.
void tket::hash_combine_paulis< QubitPauliMap > | ( | std::size_t & | seed, |
const QubitPauliMap & | paulis | ||
) |
Definition at line 469 of file PauliTensor.cpp.
|
constexpr |
A fixed square root of -1.
bool tket::in_weyl_chamber | ( | const std::array< Expr, 3 > & | k | ) |
Whether a triplet of TK2 angles are normalised.
Numerical values must be in the Weyl chamber, ie 1/2 >= k_x >= k_y >= |k_z|. Symbolic values must come before any numerical value in the array.
Definition at line 503 of file MatrixAnalysis.cpp.
void tket::insert_into_gadget_map | ( | QubitOperator & | gadget_map, |
const PauliGadgetProperties & | pgp | ||
) |
Definition at line 19 of file DiagUtils.cpp.
bool tket::is_barrier_type | ( | OpType | optype | ) |
Test for Barrier "ops".
Definition at line 149 of file OpTypeFunctions.cpp.
bool tket::is_boundary_c_type | ( | OpType | optype | ) |
Test for input or output for classical "ops".
Definition at line 178 of file OpTypeFunctions.cpp.
bool tket::is_boundary_q_type | ( | OpType | optype | ) |
Test for input, creation, output or discard quantum "ops".
Definition at line 174 of file OpTypeFunctions.cpp.
bool tket::is_boundary_type | ( | OpType | optype | ) |
Test for input, creation, output or discard "ops".
Definition at line 169 of file OpTypeFunctions.cpp.
bool tket::is_boundary_w_type | ( | OpType | optype | ) |
Test for input or output for wasm "ops".
Definition at line 182 of file OpTypeFunctions.cpp.
bool tket::is_box_type | ( | OpType | optype | ) |
Test for boxes (complex packaged operations)
Definition at line 190 of file OpTypeFunctions.cpp.
bool tket::is_classical_type | ( | OpType | optype | ) |
Test for purely classical gates.
Definition at line 281 of file OpTypeFunctions.cpp.
bool tket::is_clifford_type | ( | OpType | optype | ) |
Test for Clifford operations.
Definition at line 266 of file OpTypeFunctions.cpp.
bool tket::is_controlled_gate_type | ( | OpType | optype | ) |
Test for controlled gates.
Definition at line 285 of file OpTypeFunctions.cpp.
bool tket::is_final_q_type | ( | OpType | optype | ) |
Test for output or discard quantum "ops".
Definition at line 155 of file OpTypeFunctions.cpp.
bool tket::is_final_type | ( | OpType | optype | ) |
Test for output "ops".
Definition at line 164 of file OpTypeFunctions.cpp.
bool tket::is_flowop_type | ( | OpType | optype | ) |
Test for flowops (just for high-level control flow)
Definition at line 220 of file OpTypeFunctions.cpp.
bool tket::is_gate_type | ( | OpType | optype | ) |
Test for elementary gates.
Definition at line 186 of file OpTypeFunctions.cpp.
bool tket::is_initial_q_type | ( | OpType | optype | ) |
Test for input or creation quantum "ops".
Definition at line 151 of file OpTypeFunctions.cpp.
bool tket::is_initial_type | ( | OpType | optype | ) |
Test for input "ops".
Definition at line 159 of file OpTypeFunctions.cpp.
bool tket::is_metaop_type | ( | OpType | optype | ) |
Test for initial and final "ops".
Definition at line 142 of file OpTypeFunctions.cpp.
bool tket::is_multi_qubit_type | ( | OpType | optype | ) |
Test for gates over more than one qubit.
Definition at line 242 of file OpTypeFunctions.cpp.
bool tket::is_oneway_type | ( | OpType | optype | ) |
Test for non-invertible operations.
Definition at line 255 of file OpTypeFunctions.cpp.
bool tket::is_parameterised_pauli_rotation_type | ( | OpType | optype | ) |
Test for rotations around Pauli axes.
Definition at line 236 of file OpTypeFunctions.cpp.
bool tket::is_projective_type | ( | OpType | optype | ) |
Test for measurement and reset gates.
Definition at line 277 of file OpTypeFunctions.cpp.
bool tket::is_projector | ( | const Eigen::MatrixXcd & | P, |
double | tol | ||
) |
Definition at line 34 of file MatrixAnalysis.cpp.
bool tket::is_rotation_type | ( | OpType | optype | ) |
Test for rotations (including controlled rotations)
Definition at line 226 of file OpTypeFunctions.cpp.
bool tket::is_single_qubit_type | ( | OpType | optype | ) |
Test for gates over a single qubit.
Definition at line 246 of file OpTypeFunctions.cpp.
bool tket::is_single_qubit_unitary_type | ( | OpType | optype | ) |
Test for single-qubit gates that can be expressed as TK1.
Definition at line 251 of file OpTypeFunctions.cpp.
bool tket::is_spiderless_optype | ( | const OpType & | optype | ) |
Definition at line 29 of file ZXConverters.cpp.
bool tket::is_unitary | ( | const Eigen::MatrixXcd & | U, |
double | tol = EPS |
||
) |
Test matrix for unitarity.
The tolerance refers to the l2 (Frobenius) norm of I - U*U.
U | matrix |
tol | tolerance |
whether | the matrix is unitary to within some tolerance |
Definition at line 28 of file MatrixAnalysis.cpp.
bool tket::is_valid | ( | const DAG & | G | ) |
Check that the DAG satisfies the requirements of the Circuit class.
These requirements are described below.
Definition: call a DAG balanced if every vertex is either an initial vertex (with out-degree 1), a final vertex (with in-degree 1), or an internal vertex with its inbound edges in a defined bijection with its outbound edges. The balanced degree of an internal vertex of a balanced DAG is the common value of its in-degree and out-degree.
The edges of G are partitioned into three types: Quantum, Classical, and Boolean.
Let G_Q be the subgraph consisting of Quantum edges and their incident vertices. Let G_C be the subgraph consisting of Classical edges and their incident vertices.
From these we define the following classes of vertex:
We check the following properties:
G | DAG to check |
Definition at line 38 of file DAGProperties.cpp.
Definition at line 624 of file LexiRoute.cpp.
tket::JSON_DECL | ( | LexiRouteRoutingMethod | ) |
tket::JSON_DECL | ( | Placement::Ptr | ) |
tket::JSON_DECL | ( | RoutingMethod | ) |
tket::JSON_DECL | ( | std::vector< RoutingMethodPtr > | ) |
Definition at line 149 of file UnitID.hpp.
PassPtr tket::KAKDecomposition | ( | OpType | target_2qb_gate = OpType::CX , |
double | cx_fidelity = 1. , |
||
bool | allow_swaps = true |
||
) |
Squash sequences of two-qubit operations into minimal form.
A pass that squashes together sequences of single- and two-qubit gates into minimal form. Can decompose to TK2 or CX gates.
Two-qubit operations can always be expressed in a minimal form of maximum three CXs, or as a single TK2 gate (a result also known as the KAK or Cartan decomposition).
It is in general recommended to squash to TK2 gates, and to then use the DecomposeTK2
pass for noise-aware decompositions to other gatesets. For backward compatibility, decompositions to CX are also supported. In this case, cx_fidelity
can be provided to perform approximate decompositions to CX.
When decomposing to TK2 gates, any sequence of two or more two-qubit gates on the same set of qubits are replaced by a single TK2 gate. When decomposing to CX, the substitution is only performed if it results in a reduction of the number of CX gates, or if at least one of the two-qubit gates is not a CX.
Using the allow_swaps=true
(default) option, qubits will be swapped when convenient to further reduce the two-qubit gate count (only applicable when decomposing to CX gates).
target_2qb_gate | OpType to decompose to. Either TK2 or CX. |
cx_fidelity | Estimated CX gate fidelity, used when target_2qb_gate=CX. |
allow_swaps | Whether to allow implicit wire swaps. |
Definition at line 810 of file PassGenerators.cpp.
std::pair< Eigen::Matrix2cd, Eigen::Matrix2cd > tket::kronecker_decomposition | ( | Eigen::Matrix4cd & | U | ) |
Definition at line 416 of file MatrixAnalysis.cpp.
Eigen::PermutationMatrix< Eigen::Dynamic > tket::lift_perm | ( | const std::map< unsigned, unsigned > & | p | ) |
Lift a permutation of \( [0,n) \) to a permutation of \( [0,2^n) \) as a matrix.
The result is a \( 2^n \times 2^n \) permutation matrix representing the derived permutation on the powerset of \( [0,n) \) using big-endian encoding, i.e. a subset \( S \subseteq [0,n) \) is represented by \( f(S) = \sum_{i \in S} 2^{n-1-i} \) and the \( (f(S),f(T)) \) entry of the matrix is 1 iff \( T = p(S) \).
p | permutation of \( [0,n) \) |
Definition at line 220 of file MatrixAnalysis.cpp.
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > tket::load_dynamic_matrix | ( | const nlohmann::json & | j, |
std::size_t | rows, | ||
std::size_t | cols | ||
) |
Definition at line 327 of file PhasePoly.cpp.
MeasurementSetup tket::measurement_reduction | ( | const std::list< SpPauliString > & | strings, |
PauliPartitionStrat | strat, | ||
GraphColourMethod | method = GraphColourMethod::Lazy , |
||
CXConfigType | cx_config = CXConfigType::Snake |
||
) |
A tool for reducing the number of measurements required for variational quantum algorithms by partitioning Pauli strings into mutually commuting sets.
See: https://arxiv.org/abs/1907.07859, https://arxiv.org/abs/1908.11857, https://arxiv.org/abs/1907.13623, https://arxiv.org/abs/1908.08067, https://arxiv.org/abs/1908.06942, https://arxiv.org/abs/1907.03358
Definition at line 21 of file MeasurementReduction.cpp.
Return -e.
Expanding e after multiplying by -1 may reduce its size, especially when minus_times
is applied repeatedly and should cancel out.
e | expression |
Definition at line 119 of file Expression.cpp.
|
inline |
Definition at line 302 of file MatrixAnalysis.cpp.
Circuit tket::multi_controlled_to_2q | ( | const Op_ptr | op, |
const std::optional< OpType > & | two_q_type = std::nullopt |
||
) |
Replace CnRy, CnRx, CnRz, CnX, CnZ, CnY with 2-qubit gates and single qubit gates.
op | operation |
two_q_type | whether rebase 2-q gates to CX or TK2 |
Definition at line 31 of file Replacement.cpp.
|
delete |
Multiply together two coefficients of the same type.
Multiplication of no_coeff_t is trivial. Multiplication of quarter_turns_t adds the unsigned values (e^{i*a*pi/2} * e^{i*b*pi/2} = e^{i*(a+b)*pi/2}). Multiplication of Complex/Expr is standard multiplication.
Complex tket::multiply_coeffs< Complex > | ( | const Complex & | first, |
const Complex & | second | ||
) |
Definition at line 625 of file PauliTensor.cpp.
Complex tket::multiply_coeffs< Complex > | ( | const Complex & | first, |
const Complex & | second | ||
) |
Definition at line 625 of file PauliTensor.cpp.
Expr tket::multiply_coeffs< Expr > | ( | const Expr & | first, |
const Expr & | second | ||
) |
Definition at line 630 of file PauliTensor.cpp.
Expr tket::multiply_coeffs< Expr > | ( | const Expr & | first, |
const Expr & | second | ||
) |
Definition at line 630 of file PauliTensor.cpp.
no_coeff_t tket::multiply_coeffs< no_coeff_t > | ( | const no_coeff_t & | , |
const no_coeff_t & | |||
) |
Definition at line 614 of file PauliTensor.cpp.
no_coeff_t tket::multiply_coeffs< no_coeff_t > | ( | const no_coeff_t & | , |
const no_coeff_t & | |||
) |
Definition at line 614 of file PauliTensor.cpp.
quarter_turns_t tket::multiply_coeffs< quarter_turns_t > | ( | const quarter_turns_t & | first, |
const quarter_turns_t & | second | ||
) |
Definition at line 619 of file PauliTensor.cpp.
quarter_turns_t tket::multiply_coeffs< quarter_turns_t > | ( | const quarter_turns_t & | first, |
const quarter_turns_t & | second | ||
) |
Definition at line 619 of file PauliTensor.cpp.
|
delete |
Multiplies two Pauli containers component-wise, returning both the resulting phase and string.
Maps {P0, P1} -> {k, P2} where P0*P1 = e^{i*k*pi/2}*P2, e.g. {XIY, YZY} -> {1, ZZI} (XIY*YZY = iZZI).
std::pair< quarter_turns_t, DensePauliMap > tket::multiply_strings< DensePauliMap > | ( | const DensePauliMap & | first, |
const DensePauliMap & | second | ||
) |
Definition at line 530 of file PauliTensor.cpp.
std::pair< quarter_turns_t, DensePauliMap > tket::multiply_strings< DensePauliMap > | ( | const DensePauliMap & | first, |
const DensePauliMap & | second | ||
) |
Definition at line 530 of file PauliTensor.cpp.
std::pair< quarter_turns_t, QubitPauliMap > tket::multiply_strings< QubitPauliMap > | ( | const QubitPauliMap & | first, |
const QubitPauliMap & | second | ||
) |
Definition at line 530 of file PauliTensor.cpp.
std::pair< quarter_turns_t, QubitPauliMap > tket::multiply_strings< QubitPauliMap > | ( | const QubitPauliMap & | first, |
const QubitPauliMap & | second | ||
) |
Definition at line 530 of file PauliTensor.cpp.
Circuit tket::mutual_diagonalise | ( | std::list< SpSymPauliTensor > & | gadgets, |
std::set< Qubit > | qubits, | ||
CXConfigType | cx_config | ||
) |
Diagonalise a mutually commuting set of Pauli strings.
Modifies the list of Pauli strings in place, and returns the Clifford circuit required to generate the initial set.
Definition at line 224 of file Diagonalisation.cpp.
|
delete |
Return the number of Pauli::Ys in the container.
Used for PauliTensor::transpose().
unsigned tket::n_ys< DensePauliMap > | ( | const DensePauliMap & | paulis | ) |
Definition at line 521 of file PauliTensor.cpp.
unsigned tket::n_ys< DensePauliMap > | ( | const DensePauliMap & | paulis | ) |
Definition at line 521 of file PauliTensor.cpp.
unsigned tket::n_ys< QubitPauliMap > | ( | const QubitPauliMap & | paulis | ) |
Definition at line 512 of file PauliTensor.cpp.
unsigned tket::n_ys< QubitPauliMap > | ( | const QubitPauliMap & | paulis | ) |
Definition at line 512 of file PauliTensor.cpp.
const std::map< std::string, OpType > & tket::name_to_optype | ( | ) |
Definition at line 25 of file OpTypeJson.cpp.
ZXVertSeqSet tket::neighbours_of_frontier | ( | const ZXDiagram & | diag, |
const ZXVertVec & | frontier | ||
) |
Definition at line 670 of file ZXConverters.cpp.
tket::NLOHMANN_JSON_SERIALIZE_ENUM | ( | ClOp | , |
{ {ClOp::INVALID, "INVALID"}, {ClOp::BitAnd, "BitAnd"}, {ClOp::BitOr, "BitOr"}, {ClOp::BitXor, "BitXor"}, {ClOp::BitEq, "BitEq"}, {ClOp::BitNeq, "BitNeq"}, {ClOp::BitNot, "BitNot"}, {ClOp::BitZero, "BitZero"}, {ClOp::BitOne, "BitOne"}, {ClOp::RegAnd, "RegAnd"}, {ClOp::RegOr, "RegOr"}, {ClOp::RegXor, "RegXor"}, {ClOp::RegEq, "RegEq"}, {ClOp::RegNeq, "RegNeq"}, {ClOp::RegNot, "RegNot"}, {ClOp::RegZero, "RegZero"}, {ClOp::RegOne, "RegOne"}, {ClOp::RegLt, "RegLt"}, {ClOp::RegGt, "RegGt"}, {ClOp::RegLeq, "RegLeq"}, {ClOp::RegGeq, "RegGeq"}, {ClOp::RegAdd, "RegAdd"}, {ClOp::RegSub, "RegSub"}, {ClOp::RegMul, "RegMul"}, {ClOp::RegDiv, "RegDiv"}, {ClOp::RegPow, "RegPow"}, {ClOp::RegLsh, "RegLsh"}, {ClOp::RegRsh, "RegRsh"}, {ClOp::RegNeg, "RegNeg"}, } | |||
) |
A bit variable within an expression.
Identifier for the variable within the expression
Definition at line 73 of file ClExpr.hpp.
tket::NLOHMANN_JSON_SERIALIZE_ENUM | ( | CXConfigType | , |
{{CXConfigType::Snake, "Snake"}, {CXConfigType::Tree, "Tree"}, {CXConfigType::Star, "Star"}, {CXConfigType::MultiQGate, "MultiQGate"}} | |||
) |
tket::NLOHMANN_JSON_SERIALIZE_ENUM | ( | EdgeType | , |
{ {EdgeType::Quantum, "Q"}, {EdgeType::Classical, "C"}, {EdgeType::Boolean, "B"}, {EdgeType::WASM, "W"}, } | |||
) |
tket::NLOHMANN_JSON_SERIALIZE_ENUM | ( | Pauli | , |
{ {Pauli::I, "I"}, {Pauli::X, "X"}, {Pauli::Y, "Y"}, {Pauli::Z, "Z"}, } | |||
) |
tket::NLOHMANN_JSON_SERIALIZE_ENUM | ( | ToffoliBoxSynthStrat | , |
{{ToffoliBoxSynthStrat::Matching, "Matching"}, {ToffoliBoxSynthStrat::Cycle, "Cycle"}} | |||
) |
const std::string & tket::node_default_reg | ( | ) |
Definition at line 94 of file UnitID.cpp.
std::tuple< Circuit, std::array< Expr, 3 >, Circuit > tket::normalise_TK2_angles | ( | Expr | a, |
Expr | b, | ||
Expr | c | ||
) |
Get normalised TK2 angles and local change of basis for normalisation.
Given any TK2 angles, return the equivalent normalised TK2 angles as well as the two change of basis circuits pre
and post
so that
TK2(a, b, c) = post * TK2(a', b', c') * pre
where a, b, c are the TK2 angles and a', b', c' are the equivalent normalised angles.
a | first TK2 parameter |
b | second TK2 parameter |
c | third TK2 parameter |
Definition at line 1269 of file CircUtils.cpp.
const PassPtr & tket::NormaliseTK2 | ( | ) |
Normalises all TK2 gates.
TK2 gates have three angles in the interval [0, 4], but these can always be normalised to be within the so-called Weyl chamber by adding single-qubit gates.
More precisely, the three angles a, b, c of TK2(a, b, c) are normalised exactly when the two following conditions are met:
After this pass, all TK2 angles will be normalised and the circuit will satisfy NormalisedTK2Predicate
.
Definition at line 386 of file PassLibrary.cpp.
std::shared_ptr< ExplicitPredicateOp > tket::NotOp | ( | ) |
Unary NOT operator.
Definition at line 435 of file ClassicalOps.cpp.
Eigen::Matrix2cd tket::nth_root | ( | const Eigen::Matrix2cd & | u, |
unsigned long long | n | ||
) |
Get an nth root of a 2x2 unitary matrix.
Definition at line 528 of file MatrixAnalysis.cpp.
Definition at line 125 of file macro_manipulation.cpp.
bool tket::operator< | ( | const PauliGadgetProperties & | pgp1, |
const PauliGadgetProperties & | pgp2 | ||
) |
Definition at line 25 of file PauliGraph.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
ClOp | fn | ||
) |
Definition at line 30 of file ClExpr.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const ChoiMixTableau & | tab | ||
) |
Definition at line 678 of file ChoiMixTableau.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const ClBitVar & | var | ||
) |
Definition at line 94 of file ClExpr.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const ClExpr & | expr | ||
) |
Definition at line 231 of file ClExpr.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const ClExprArg & | arg | ||
) |
Definition at line 166 of file ClExpr.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const ClExprTerm & | term | ||
) |
Definition at line 134 of file ClExpr.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const ClExprVar & | var | ||
) |
Definition at line 102 of file ClExpr.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const ClRegVar & | var | ||
) |
Definition at line 98 of file ClExpr.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const Rotation & | q | ||
) |
Definition at line 372 of file Rotation.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const SymplecticTableau & | tab | ||
) |
Definition at line 107 of file SymplecticTableau.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const UnitaryRevTableau & | tab | ||
) |
Definition at line 712 of file UnitaryTableau.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const UnitaryTableau & | tab | ||
) |
Definition at line 472 of file UnitaryTableau.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
const WiredClExpr & | expr | ||
) |
Definition at line 344 of file ClExpr.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | os, |
Op const & | operation | ||
) |
std::ostream & tket::operator<< | ( | std::ostream & | out, |
const Circuit & | circ | ||
) |
Definition at line 108 of file basic_circ_manip.cpp.
std::ostream & tket::operator<< | ( | std::ostream & | out, |
const DiagMatrix & | diam | ||
) |
Definition at line 240 of file macro_manipulation.cpp.
Definition at line 221 of file CompilerPass.cpp.
[in] | lhs | first transform |
[in] | rhs | second transform |
Definition at line 23 of file Combinator.cpp.
const std::map< OpType, OpTypeInfo > & tket::optypeinfo | ( | ) |
Information including name and shape of each operation type.
Definition at line 23 of file OpTypeInfo.cpp.
std::shared_ptr< ExplicitPredicateOp > tket::OrOp | ( | ) |
Binary OR operator.
Definition at line 449 of file ClassicalOps.cpp.
std::shared_ptr< ExplicitModifierOp > tket::OrWithOp | ( | ) |
In-place OR with another input.
Definition at line 470 of file ClassicalOps.cpp.
std::set< unsigned > tket::own_indices | ( | const DensePauliMap & | first, |
const DensePauliMap & | second | ||
) |
Find the set of qubits (as unsigned integer indices) on which first
has a non-trivial Pauli (X, Y, Z) but second
either doesn't contain (>= size) or maps to I.
Definition at line 318 of file PauliTensor.cpp.
std::set< Qubit > tket::own_qubits | ( | const QubitPauliMap & | first, |
const QubitPauliMap & | second | ||
) |
Find the set of Qubits on which first
has a non-trivial Pauli (X, Y, Z) but second
either doesn't contain or maps to I.
Definition at line 307 of file PauliTensor.cpp.
DensePauliMap tket::pad_sparse_pauli_map | ( | const QubitPauliMap & | sparse_string, |
size_t | size | ||
) |
Definition at line 546 of file PauliExpBoxes.cpp.
Circuit tket::pauli_gadget | ( | SpSymPauliTensor | pauli, |
CXConfigType | cx_config = CXConfigType::Snake |
||
) |
Construct a 'Pauli gadget' corresponding to a tensor of Pauli operators.
The returned circuit implements the unitary operator \( e^{-\frac12 i \pi t \sigma_0 \otimes \sigma_1 \otimes \cdots} \) where \( \sigma_i \in \{I,X,Y,Z\} \) are the Pauli operators.
pauli | Pauli operators; coefficient gives rotation angle in half-turns |
cx_config | CX configuration |
Definition at line 275 of file CircUtils.cpp.
Circuit tket::pauli_gadget_pair | ( | SpSymPauliTensor | paulis0, |
SpSymPauliTensor | paulis1, | ||
CXConfigType | cx_config = CXConfigType::Snake |
||
) |
Construct a circuit realising a pair of Pauli gadgets with the fewest two-qubit gates.
The returned circuit implements the unitary e^{-i pi angle1 paulis1 / 2} e^{-i pi angle0 paulis0 / 2}, i.e. a gadget of angle0 about paulis0 followed by a gadget of angle1 about paulis1.
paulis0 | Pauli operators for first gadget; coefficient gives rotation angle in half-turns |
paulis1 | Pauli operators for second gadget; coefficient gives rotation angle in half-turns |
cx_config | CX configuration |
Definition at line 365 of file CircUtils.cpp.
Circuit tket::pauli_graph_to_pauli_exp_box_circuit_individually | ( | const PauliGraph & | pg, |
CXConfigType | cx_config = CXConfigType::Snake |
||
) |
Synthesises a circuit equivalent to the PauliGraph by adding each pauli gadget to the circuit as a PauliExpBox individually in the order given by TopSortIterator.
The tableau is then synthesised at the end.
Definition at line 51 of file PauliGraphConverters.cpp.
Circuit tket::pauli_graph_to_pauli_exp_box_circuit_pairwise | ( | const PauliGraph & | pg, |
CXConfigType | cx_config | ||
) |
Synthesises a circuit equivalent to the PauliGraph by inserting pairs of pauli gadgets as PauliExpPairBoxes into the circuit The tableau is then synthesised at the end.
Definition at line 74 of file PauliGraphConverters.cpp.
Circuit tket::pauli_graph_to_pauli_exp_box_circuit_sets | ( | const PauliGraph & | pg, |
CXConfigType | cx_config | ||
) |
Synthesises a circuit equivalent to the PauliGraph by building sets of mutually commuting pauli gadgets and inserting them into the circuit as PauliExpCommutingSetBoxes The tableau is then synthesised at the end.
Definition at line 113 of file PauliGraphConverters.cpp.
PassPtr tket::PauliSquash | ( | Transforms::PauliSynthStrat | strat, |
CXConfigType | cx_config | ||
) |
Builds a sequence of PauliSimp (gen_synthesise_pauli_graph) and FullPeepholeOptimise.
Definition at line 1154 of file PassGenerators.cpp.
PassPtr tket::PeepholeOptimise2Q | ( | bool | allow_swaps = true | ) |
Performs peephole optimisation including resynthesis of 2-qubit gate sequences, and converts to a circuit containing CX and TK1 gates.
allow_swaps | whether to allow introduction of implicit wire swaps Expects: Any gates Produces: CX, TK1 |
Definition at line 878 of file PassGenerators.cpp.
Circuit tket::phase_gadget | ( | unsigned | n_qubits, |
const Expr & | angle, | ||
CXConfigType | cx_config = CXConfigType::Snake |
||
) |
Construct a phase gadget.
n_qubits | number of qubits |
angle | phase parameter |
cx_config | CX configuration |
Definition at line 270 of file CircUtils.cpp.
const std::string & tket::predicate_name | ( | std::type_index | idx | ) |
Definition at line 57 of file Predicates.cpp.
|
delete |
void tket::print_coeff< Complex > | ( | std::ostream & | os, |
const Complex & | coeff | ||
) |
Definition at line 450 of file PauliTensor.cpp.
void tket::print_coeff< Complex > | ( | std::ostream & | os, |
const Complex & | coeff | ||
) |
Definition at line 450 of file PauliTensor.cpp.
void tket::print_coeff< Expr > | ( | std::ostream & | os, |
const Expr & | coeff | ||
) |
Definition at line 459 of file PauliTensor.cpp.
void tket::print_coeff< Expr > | ( | std::ostream & | os, |
const Expr & | coeff | ||
) |
Definition at line 459 of file PauliTensor.cpp.
void tket::print_coeff< no_coeff_t > | ( | std::ostream & | , |
const no_coeff_t & | |||
) |
Generates the coefficient prefix for PauliTensor::to_str()
Definition at line 425 of file PauliTensor.cpp.
void tket::print_coeff< no_coeff_t > | ( | std::ostream & | , |
const no_coeff_t & | |||
) |
Generates the coefficient prefix for PauliTensor::to_str()
Definition at line 425 of file PauliTensor.cpp.
void tket::print_coeff< quarter_turns_t > | ( | std::ostream & | os, |
const quarter_turns_t & | coeff | ||
) |
Definition at line 428 of file PauliTensor.cpp.
void tket::print_coeff< quarter_turns_t > | ( | std::ostream & | os, |
const quarter_turns_t & | coeff | ||
) |
Definition at line 428 of file PauliTensor.cpp.
|
delete |
Generates the readable Pauli string portion of PauliTensor::to_str().
Dense strings are printed as e.g. XIYZ. Sparse strings are printed as e.g. (Xq[0], Yq[2], Zq[3]).
void tket::print_paulis< DensePauliMap > | ( | std::ostream & | os, |
const DensePauliMap & | paulis | ||
) |
Definition at line 400 of file PauliTensor.cpp.
void tket::print_paulis< DensePauliMap > | ( | std::ostream & | os, |
const DensePauliMap & | paulis | ||
) |
Definition at line 400 of file PauliTensor.cpp.
void tket::print_paulis< QubitPauliMap > | ( | std::ostream & | os, |
const QubitPauliMap & | paulis | ||
) |
Definition at line 369 of file PauliTensor.cpp.
void tket::print_paulis< QubitPauliMap > | ( | std::ostream & | os, |
const QubitPauliMap & | paulis | ||
) |
Definition at line 369 of file PauliTensor.cpp.
std::tuple< Circuit, std::vector< bool > > tket::projector_assertion_synthesis | ( | const Eigen::MatrixXcd & | P | ) |
Synthesise an assertion circuit from an arbitrary 2x2, 4x4 or 8x8 projector matrix.
P | projector matrix in BasisOrder::ilo |
Definition at line 218 of file AssertionSynthesis.cpp.
const std::string & tket::q_default_reg | ( | ) |
Definition at line 70 of file UnitID.cpp.
const std::string & tket::q_routing_ancilla_reg | ( | ) |
Definition at line 76 of file UnitID.cpp.
const PassPtr & tket::RebaseTket | ( | ) |
Definition at line 75 of file PassLibrary.cpp.
const PassPtr & tket::RebaseUFR | ( | ) |
Definition at line 82 of file PassLibrary.cpp.
Definition at line 390 of file macro_manipulation.cpp.
std::pair< Circuit, Qubit > tket::reduce_anticommuting_paulis_to_z_x | ( | SpPauliStabiliser | pauli0, |
SpPauliStabiliser | pauli1, | ||
CXConfigType | cx_config | ||
) |
Given a pair of anticommuting Pauli tensors P0, P1, produces a short Clifford circuit C which maps P0 to Z and P1 to X on the same qubit, i.e.
Z_i C P0 = C = X_i C P1. This can be viewed as the components required to synthesise a pair of noncommuting Pauli gadgets C^dag RX(b)_i RZ(a)_i C = exp(-i pi b P1/2) exp(-i pi a P0/2) (up to global phase). This is not strictly a diagonalisation because anticommuting strings cannot be simultaneously diagonalised. Returns the circuit C and the qubit i where the Z and X end up.
Reduce each remaining Pauli to the shared mismatching qubit. Since reduce_pauli_to_Z does not allow us to pick the final qubit, we reserve the mismatching qubit, call reduce_pauli_to_Z on the rest, and add a CX.
Definition at line 697 of file Diagonalisation.cpp.
std::tuple< Circuit, Qubit, Qubit > tket::reduce_commuting_paulis_to_zi_iz | ( | SpPauliStabiliser | pauli0, |
SpPauliStabiliser | pauli1, | ||
CXConfigType | cx_config | ||
) |
Given a pair of commuting Pauli tensors P0, P1, produces a short Clifford circuit C which maps P0 and P1 to Z on different qubits, i.e.
Z_i C P0 = C = Z_j C P1. This can be viewed as the components required to synthesise a pair of commuting Pauli gadgets C^dag RZ(b)_j RZ(a)_i C = exp(-i pi b P1/2) exp(-i pi a P0/2) (up to global phase), or as a mutual diagonalisation of two Pauli strings along with CXs to reduce them to independent, individual qubits. Returns the circuit C and the qubits i and j where the Zs end up.
Reduce each remaining Pauli to a single qubit.
Definition at line 733 of file Diagonalisation.cpp.
std::pair< Circuit, std::optional< Qubit > > tket::reduce_overlap_of_paulis | ( | SpPauliStabiliser & | pauli0, |
SpPauliStabiliser & | pauli1, | ||
CXConfigType | cx_config, | ||
bool | allow_matching_final = false |
||
) |
Given a pair of (either commuting or anticommuting) Pauli tensors P0, P1, produces a short Clifford circuit C which maps P0 and P1 to strings which overlap on at most one qubit (which is also returned).
If P0 and P1 anticommute, a mismatching qubit is always left. If they commute, contain at least one matching qubit and no mismatching qubits, then the final matching qubit is returned if allow_matching_final is true, otherwise P0 and P1 are reduced to non-overlapping strings.
Definition at line 508 of file Diagonalisation.cpp.
std::pair< Circuit, Qubit > tket::reduce_pauli_to_z | ( | const SpPauliStabiliser & | pauli, |
CXConfigType | cx_config | ||
) |
Given a Pauli tensor P, produces a short Clifford circuit C which maps P to Z on a single qubit, i.e.
Z_i C P = C. This can be viewed as the components required to synthesise a single Pauli gadget C^dag RZ(a)_i C = exp(-i pi a P/2) (up to global phase), or as a diagonalisation of a single Pauli string along with CXs to reduce it to a single qubit. Returns the circuit C and the qubit i where the Z ends up.
This is only equal to the CX decompositions above up to phase, but phase differences are cancelled out by its dagger
Definition at line 344 of file Diagonalisation.cpp.
bool tket::remove_all_gadgets | ( | ZXDiagram & | diag, |
const ZXVertVec & | frontier, | ||
std::map< ZXVert, ZXVert > & | input_qubits | ||
) |
Definition at line 713 of file ZXConverters.cpp.
const PassPtr & tket::RemoveBarriers | ( | ) |
Remove all& OpType::Barrier from the circuit.
Definition at line 302 of file PassLibrary.cpp.
const PassPtr & tket::RemoveDiscarded | ( | ) |
Remove all operations that have no OpType::Output or OpType::ClOutput in their causal future.
Definition at line 356 of file PassLibrary.cpp.
const PassPtr & tket::RemoveImplicitQubitPermutation | ( | ) |
Remove any implicit qubit permutation by appending SWAP gates.
Note that if the circuit contains measurements, they may become mid-circuit measurements in the transformed circuit.
Definition at line 451 of file PassLibrary.cpp.
const PassPtr & tket::RemovePhaseOps | ( | ) |
Remove all OpType::Phase (including conditionals) from the circuit.
Definition at line 532 of file PassLibrary.cpp.
const PassPtr & tket::RemoveRedundancies | ( | ) |
Definition at line 89 of file PassLibrary.cpp.
void tket::replace_CX_with_TK2 | ( | Circuit & | c | ) |
Utility function to replace all CX gates with TK2 and single-qubit gates.
c | circuit to modify |
Definition at line 410 of file CircUtils.cpp.
bool tket::respects_connectivity_constraints | ( | const Circuit & | circ, |
const Architecture & | arch, | ||
bool | directed, | ||
bool | bridge_allowed = false |
||
) |
Check that the circuit respects architectural constraints.
circ | circuit to check |
arch | architecture |
directed | if true, disallow two-qubit gates except for CX |
bridge_allowed | whether 3-qubit OpType::BRIDGE operations are allowed |
Definition at line 18 of file Verification.cpp.
uint64_t tket::reverse_bits | ( | uint64_t | v, |
unsigned | w | ||
) |
Reverse bits 0,1,...,w-1 of the number v, assuming v < 2^w and w <= 64.
Definition at line 40 of file HelperFunctions.cpp.
Eigen::Matrix4cd tket::reverse_indexing | ( | const Eigen::Matrix4cd & | m | ) |
Definition at line 257 of file MatrixAnalysis.cpp.
Eigen::MatrixXcd tket::reverse_indexing | ( | const Eigen::MatrixXcd & | m | ) |
Definition at line 266 of file MatrixAnalysis.cpp.
Eigen::VectorXcd tket::reverse_indexing | ( | const Eigen::VectorXcd & | v | ) |
Definition at line 273 of file MatrixAnalysis.cpp.
Definition at line 261 of file MatrixAnalysis.cpp.
PassPtr tket::RoundAngles | ( | unsigned | n, |
bool | only_zeros = false |
||
) |
Generate a pass that rounds all angles to the nearest \( \pi / 2^n \).
In particular, angles smaller than \( \pi / 2^{n+1} \) are set to zero; if a gate is turned into the identity by this operation it is removed.
n | precision to retain in angles |
only_zeros | only set angles smaller than \( \pi / 2^{n+1} \) to zero |
@ pre n < 32
Definition at line 1160 of file PassGenerators.cpp.
nlohmann::json tket::serialise | ( | const BasePass & | bp | ) |
Definition at line 355 of file CompilerPass.cpp.
nlohmann::json tket::serialise | ( | const PassPtr & | pp | ) |
Definition at line 356 of file CompilerPass.cpp.
nlohmann::json tket::serialise | ( | const std::vector< PassPtr > & | pp | ) |
Definition at line 357 of file CompilerPass.cpp.
Op_ptr tket::set_box_id | ( | BoxT & | b, |
boost::uuids::uuid | newid | ||
) |
const PassPtr & tket::SimplifyMeasured | ( | ) |
Replace all measured classical maps that are followed by Measure operations whose quantum output is discarded with classical operations following the Measure.
Definition at line 368 of file PassLibrary.cpp.
Return sin(e*pi/2)
If e is within EPS
of an integer then it is rounded so that the result can be evaluated.
Definition at line 115 of file Expression.cpp.
const PassPtr & tket::SquashRzPhasedX | ( | ) |
Squash single qubit gates into PhasedX and Rz gates.
Commute Rzs to the back if possible.
Definition at line 423 of file PassLibrary.cpp.
const PassPtr & tket::SquashTK1 | ( | ) |
Squash sequences of single-qubit gates to TK1 gates.
Definition at line 248 of file PassLibrary.cpp.
std::tuple< Circuit, std::vector< bool > > tket::stabiliser_assertion_synthesis | ( | const PauliStabiliserVec & | paulis | ) |
Synthesise an assertion circuit from a list of Paulis strings with +/-1 coefficients.
paulis | list of Paulis strings |
Definition at line 340 of file AssertionSynthesis.cpp.
const PassPtr & tket::SynthesiseTK | ( | ) |
Definition at line 63 of file PassLibrary.cpp.
const PassPtr & tket::SynthesiseTket | ( | ) |
Definition at line 69 of file PassLibrary.cpp.
std::list< std::list< SpPauliString > > tket::term_sequence | ( | const std::list< SpPauliString > & | strings, |
PauliPartitionStrat | strat, | ||
GraphColourMethod | method = GraphColourMethod::Lazy |
||
) |
Partitions a QubitOperator into lists of mutually commuting gadgets.
Assumes that each SpPauliString
is unique and does not attempt to combine them. If it is given non-unique tensors it will produce inefficient results.
Definition at line 265 of file PauliPartition.cpp.
Circuit tket::three_qubit_synthesis | ( | const Eigen::MatrixXcd & | U | ) |
Synthesise a 3-qubit circuit from an arbitrary 8x8 unitary.
The returned circuit consists of CX, TK1, H, Ry and Rz gates only. It contains a maximum of 20 CX gates.
U | unitary matrix in BasisOrder::ilo |
Definition at line 436 of file ThreeQubitConversion.cpp.
Circuit tket::three_qubit_tk_synthesis | ( | const Eigen::MatrixXcd & | U | ) |
Synthesise a 3-qubit circuit from an arbitrary 8x8 unitary.
The returned circuit consists of TK2 and 1-qubit gates only. It contains a maximum of 15 TK2 gates.
U | unitary matrix in BasisOrder::ilo |
Definition at line 470 of file ThreeQubitConversion.cpp.
PassPtr tket::ThreeQubitSquash | ( | bool | allow_swaps = true | ) |
Resynthesize and squash three-qubit interactions.
Steps through the circuit accumulating sequences of 2- and 3-qubit interactions, where possible squashing them into subcircuits having lower CX count, then applies Clifford simplification.
allow_swaps | whether to allow introduction of implicit swaps |
Definition at line 859 of file PassGenerators.cpp.
std::vector< double > tket::tk1_angles_from_unitary | ( | const Eigen::Matrix2cd & | U | ) |
Construct TK1 angles and phase from matrix.
U | 2x2 unitary matrix |
Definition at line 385 of file Rotation.cpp.
Replace a multi-qubit operation with an equivalent circuit using TK2 gates.
op | operation |
op
is a multi-qubit operationDefinition at line 88 of file Replacement.cpp.
void tket::to_json | ( | nlohmann::json & | , |
const no_coeff_t & | |||
) |
Definition at line 21 of file PauliTensor.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const Architecture & | ar | ||
) |
Definition at line 214 of file Architecture.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const Architecture::Connection & | link | ||
) |
Definition at line 204 of file Architecture.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const Bit & | cb | ||
) |
Definition at line 37 of file UnitID.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const ChoiMixTableau & | tab | ||
) |
Definition at line 700 of file ChoiMixTableau.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const ChoiMixTableau::TableauSegment & | seg | ||
) |
Definition at line 690 of file ChoiMixTableau.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const Circuit & | circ | ||
) |
Definition at line 19 of file CircuitJson.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const ClExpr & | expr | ||
) |
Definition at line 253 of file ClExpr.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const ClExprArg & | arg | ||
) |
Definition at line 175 of file ClExpr.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const ClExprTerm & | term | ||
) |
Definition at line 143 of file ClExpr.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const ClExprVar & | var | ||
) |
Definition at line 111 of file ClExpr.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const Command & | com | ||
) |
Definition at line 22 of file CommandJson.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const composite_def_ptr_t & | cdef | ||
) |
void tket::to_json | ( | nlohmann::json & | j, |
const DeviceCharacterisation & | dc | ||
) |
Definition at line 97 of file DeviceCharacterisation.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const FullyConnected & | ar | ||
) |
Definition at line 243 of file Architecture.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const MeasurementSetup & | setup | ||
) |
Definition at line 119 of file MeasurementSetup.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const MeasurementSetup::MeasurementBitMap & | result | ||
) |
Definition at line 105 of file MeasurementSetup.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const Node & | node | ||
) |
Definition at line 45 of file UnitID.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const OpType & | type | ||
) |
Definition at line 38 of file OpTypeJson.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const PauliTensor< PauliContainer, CoeffType > & | tensor | ||
) |
Definition at line 1023 of file PauliTensor.hpp.
void tket::to_json | ( | nlohmann::json & | j, |
const Placement::Ptr & | placement_ptr | ||
) |
Definition at line 124 of file Placement.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const PredicatePtr & | pred_ptr | ||
) |
Definition at line 680 of file Predicates.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const Qubit & | qb | ||
) |
Definition at line 34 of file UnitID.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const qubit_map_t & | qm | ||
) |
Definition at line 48 of file UnitID.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const ResourceBounds< T > & | bounds | ||
) |
Definition at line 48 of file ResourceData.hpp.
void tket::to_json | ( | nlohmann::json & | j, |
const ResourceData & | data | ||
) |
Definition at line 25 of file ResourceData.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const RoutingMethod & | rm | ||
) |
Definition at line 26 of file RoutingMethodJson.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const std::vector< RoutingMethodPtr > & | rmp_v | ||
) |
Definition at line 32 of file RoutingMethodJson.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const SymplecticTableau & | tab | ||
) |
Definition at line 421 of file SymplecticTableau.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const UnitaryRevTableau & | tab | ||
) |
Definition at line 735 of file UnitaryTableau.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const UnitaryTableau & | tab | ||
) |
Definition at line 512 of file UnitaryTableau.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const WasmState & | wb | ||
) |
Definition at line 40 of file UnitID.cpp.
void tket::to_json | ( | nlohmann::json & | j, |
const WiredClExpr & | expr | ||
) |
Definition at line 398 of file ClExpr.cpp.
|
delete |
Evaluates a Pauli container to a sparse matrix describing the tensor product of each Pauli in the string.
The matrix gives the operator in ILO-BE format, e.g. (Zq[0], Xq[1]): 0 1 0 0 1 0 0 0 0 0 0 -1 0 0 -1 0
For sparse Pauli containers, just those qubits present in the container will be treated as part of the Pauli string (e.g. (Zq[1], Iq[2]) is treated as ZI since q[0] is ignored but q[2] is present in the string), so it is often preferred to use the other variants which explicitly provide the expected qubits.
|
delete |
Evaluates a Pauli container to a sparse matrix describing the tensor product of each Pauli in the string.
qubits
dictates the order of the qubits in the tensor product, with the operator returned in Big Endian format. E.g. (Zq[0], Xq[1]), [q[1], q[0]]: 0 0 1 0 0 0 0 -1 1 0 0 0 0 -1 0 0
|
delete |
Evaluates a Pauli container to a sparse matrix describing the tensor product of each Pauli in the string.
Qubits are restricted to the default register, from q[0] to q[ n_qubits
- 1], then presents the operator in ILO-BE format (if a sparse container contains Qubits outside of this range or not in the default register, an exception is thrown). E.g. (Zq[0]), 2: 1 0 0 0 0 -1 0 0 0 0 1 0 0 0 0 -1
CmplxSpMat tket::to_sparse_matrix< DensePauliMap > | ( | const DensePauliMap & | paulis | ) |
Definition at line 678 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< DensePauliMap > | ( | const DensePauliMap & | paulis | ) |
Definition at line 678 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< DensePauliMap > | ( | const DensePauliMap & | paulis, |
const qubit_vector_t & | qubits | ||
) |
Definition at line 728 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< DensePauliMap > | ( | const DensePauliMap & | paulis, |
const qubit_vector_t & | qubits | ||
) |
Definition at line 728 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< DensePauliMap > | ( | const DensePauliMap & | paulis, |
unsigned | n_qubits | ||
) |
Definition at line 696 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< DensePauliMap > | ( | const DensePauliMap & | paulis, |
unsigned | n_qubits | ||
) |
Definition at line 696 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< QubitPauliMap > | ( | const QubitPauliMap & | paulis | ) |
Definition at line 671 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< QubitPauliMap > | ( | const QubitPauliMap & | paulis | ) |
Definition at line 671 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< QubitPauliMap > | ( | const QubitPauliMap & | paulis, |
const qubit_vector_t & | qubits | ||
) |
Definition at line 708 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< QubitPauliMap > | ( | const QubitPauliMap & | paulis, |
const qubit_vector_t & | qubits | ||
) |
Definition at line 708 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< QubitPauliMap > | ( | const QubitPauliMap & | paulis, |
unsigned | n_qubits | ||
) |
Definition at line 689 of file PauliTensor.cpp.
CmplxSpMat tket::to_sparse_matrix< QubitPauliMap > | ( | const QubitPauliMap & | paulis, |
unsigned | n_qubits | ||
) |
Definition at line 689 of file PauliTensor.cpp.
double tket::trace_fidelity | ( | double | a, |
double | b, | ||
double | c | ||
) |
Similarity measure of TK2(a, b, c) to SU(4) identity.
This computes the fidelity between TK2(a, b, c) and the 2-qubit identity.
a, b and c must be in the Weyl chamber, i.e. 1/2 >= a >= b >= |c|.
This is computed using the formula Fidᵤ = (4 + Tr(Id₄U)) / 20 = (4 + Tr(U)) / 20 where U is the 4x4 matrix of TK2(a, b, c).
Tr(U) can in turn be computed as Tr(U) = 4cos(a)cos(b)cos(c) − 4i sin(a)sin(b)sin(c).
These are formulas B3 and B5 of https://arxiv.org/pdf/1811.12926.pdf. Refer to that paper for more details.
a | The XX interaction angle |
b | The YY interaction angle |
c | The ZZ interaction angle |
Definition at line 292 of file MatrixAnalysis.cpp.
Definition at line 173 of file Architecture.cpp.
int tket::tri_lexicographical_comparison | ( | const std::vector< std::size_t > & | dist1, |
const std::vector< std::size_t > & | dist2 | ||
) |
Definition at line 173 of file Architecture.cpp.
void tket::trivial_callback | ( | const CompilationUnit & | , |
const nlohmann::json & | |||
) |
Default callback when applying a pass (does nothing)
Definition at line 31 of file CompilerPass.cpp.
Circuit tket::two_qubit_canonical | ( | const Eigen::Matrix4cd & | U, |
OpType | target_2qb_gate = OpType::TK2 |
||
) |
Convert a 4x4 unitary matrix optimally to a corresponding circuit.
This will express U
using CX gates or a single TK2 gate. See also decompose_TK2
to decompose the TK2 gate further into other primitives.
U | unitary matrix |
target_2qb_gate | whether to decompose to TK2 or CX (default: TK2) |
U
is in BasisOrder::ilo Definition at line 145 of file CircUtils.cpp.
MatrixT tket::unitary_product2 | ( | const MatrixT & | U, |
const MatrixT & | V | ||
) |
Compute the product of two unitary matrices, with error correction.
The arguments are assumed to be unitary.
Definition at line 208 of file MatrixAnalysis.hpp.
MatrixT tket::unitary_product3 | ( | const MatrixT & | U, |
const MatrixT & | V, | ||
const MatrixT & | W | ||
) |
Compute the product of three unitary matrices, with error correction.
The arguments are assumed to be unitary.
Definition at line 219 of file MatrixAnalysis.hpp.
Circuit tket::unitary_rev_tableau_to_circuit | ( | const UnitaryRevTableau & | tab | ) |
Definition at line 255 of file UnitaryTableauConverters.cpp.
Circuit tket::unitary_tableau_to_circuit | ( | const UnitaryTableau & | tab | ) |
Constructs a circuit producing the same effect as the tableau.
Uses the method from Aaronson-Gottesman: Improved Simulation of Stabilizer Circuits, Theorem 8. CAUTION: GATE COUNT IS ATROCIOUS IN PRACTICE
Definition at line 31 of file UnitaryTableauConverters.cpp.
void tket::unitid_to_json | ( | nlohmann::json & | j, |
const Unit_T & | unit | ||
) |
Definition at line 142 of file UnitID.hpp.
bool tket::update_maps | ( | std::shared_ptr< unit_bimaps_t > | maps, |
const std::map< UnitA, UnitB > & | um_initial, | ||
const std::map< UnitA, UnitB > & | um_final | ||
) |
Update a pair of "initial" and "final" correspondences.
If maps
is null then the function does nothing and returns false.
[in,out] | maps | maps to be updated |
[in] | um_initial | new correspondences added to initial map |
[in] | um_final | new correspondences added to final map |
UnitA | first unit type |
UnitB | second unit type |
Definition at line 361 of file UnitID.hpp.
const std::string & tket::w_default_reg | ( | ) |
Definition at line 88 of file UnitID.cpp.
Construct a controlled version of a given circuit.
c | circuit |
n_controls | number of controls |
c
consists only of unitary Gate operations c
has a single default qubit register c
has no implicit wireswaps c
in the same order Definition at line 1254 of file CircUtils.cpp.
Express a gate as a circuit using CX as the only multi-qubit gate.
op | operation |
Definition at line 523 of file CircUtils.cpp.
Express a gate as a circuit using TK2 as the only multi-qubit gate.
op | operation |
Definition at line 415 of file CircUtils.cpp.
std::shared_ptr< ExplicitPredicateOp > tket::XorOp | ( | ) |
Binary XOR operator.
Definition at line 456 of file ClassicalOps.cpp.
std::shared_ptr< ExplicitModifierOp > tket::XorWithOp | ( | ) |
In-place XOR with another input.
Definition at line 477 of file ClassicalOps.cpp.
Circuit tket::zx_to_circuit | ( | const zx::ZXDiagram & | diag | ) |
Takes a unitary ZX diagram in MBQC form with the promise that a gflow exists.
Produces an equivalent circuit using the gate extraction method from Backens et al., "There and Back Again: A Circuit Extraction Tale".
Definition at line 822 of file ZXConverters.cpp.
const PassPtr & tket::ZXGraphlikeOptimisation | ( | bool | allow_swaps = true | ) |
Attempt to optimise the circuit by simplifying in ZX calculus and extracting a circuit back out.
Due to limitations in extraction, will not work if the circuit contains created or discarded qubits.
As a resynthesis pass, this will ignore almost all optimisations achieved beforehand and may increase the cost of the circuit.
allow_swaps | Determines whether the extracted circuit may have implicit wire swaps. If set to false, implict wire swaps will be removed by adding SWAP gates at the end of the circuit. |
Definition at line 476 of file PassLibrary.cpp.
const PassPtr & tket::ZZPhaseToRz | ( | ) |
Converts ZZPhase with angle 1 or -1 to two Rz(1) gates.
Definition at line 406 of file PassLibrary.cpp.
|
inline |
Unspecified unsigned integer.
Definition at line 29 of file OpDesc.hpp.
tket::ClBitVar |
Definition at line 99 of file ClExpr.hpp.
|
constexpr |
Default tolerance for floating-point comparisons.
Definition at line 38 of file Constants.hpp.
|
constexpr |
\( \pi \)
Definition at line 41 of file Constants.hpp.