Loading [MathJax]/extensions/tex2jax.js
tket
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Concepts
Public Member Functions | List of all members
tket::MultiBitOp Class Reference

A classical operation applied simultaneously to multiple bits. More...

#include <ClassicalOps.hpp>

Inheritance diagram for tket::MultiBitOp:
Inheritance graph
[legend]
Collaboration diagram for tket::MultiBitOp:
Collaboration graph
[legend]

Public Member Functions

 MultiBitOp (std::shared_ptr< const ClassicalEvalOp > op, unsigned n)
 
Op_ptr symbol_substitution (const SymEngine::map_basic_basic &) const override
 Operation with values for symbols substituted.
 
std::string get_name (bool latex) const override
 String representation.
 
std::shared_ptr< const ClassicalEvalOpget_op () const
 
unsigned get_n () const
 
std::vector< bool > eval (const std::vector< bool > &x) const override
 Evaluation.
 
bool is_equal (const Op &other) const override
 Equality check between two MultiBitOp instances.
 
- Public Member Functions inherited from tket::ClassicalEvalOp
 ClassicalEvalOp (OpType type, unsigned n_i, unsigned n_io, unsigned n_o, const std::string &name="")
 Construct a ClassicalEvalOp of specified shape.
 
- Public Member Functions inherited from tket::ClassicalOp
 ClassicalOp (OpType type, unsigned n_i, unsigned n_io, unsigned n_o, const std::string &name="")
 Construct a ClassicalOp of specified shape.
 
SymSet free_symbols () const override
 Set of all free symbols occurring in operation parameters.
 
unsigned n_qubits () const override
 
op_signature_t get_signature () const override
 Vector specifying type of data for each port on op.
 
nlohmann::json serialize () const override
 
unsigned get_n_i () const
 Number of input-only bits.
 
unsigned get_n_io () const
 Number of input-output bits.
 
unsigned get_n_o () const
 Number of output-only bits.
 
- Public Member Functions inherited from tket::Op
virtual Op_ptr dagger () const
 Inverse (of a unitary operation)
 
virtual Op_ptr transpose () const
 Transpose of a unitary operation.
 
virtual std::vector< Exprget_params () const
 Sequence of phase parameters, if applicable.
 
virtual std::vector< Exprget_params_reduced () const
 Sequence of phase parameters reduced to canonical range, if applicable.
 
virtual std::string get_command_str (const unit_vector_t &args) const
 Command representation.
 
OpDesc get_desc () const
 Get operation descriptor.
 
OpType get_type () const
 Get operation type.
 
virtual std::optional< Paulicommuting_basis (port_t i) const
 Which Pauli, if any, commutes with the operation at a given port.
 
virtual bool commutes_with_basis (const std::optional< Pauli > &colour, port_t i) const
 Whether the operation commutes with the given Pauli at the given port.
 
virtual bool is_extern () const
 return if the op is external
 
virtual std::optional< double > is_identity () const
 Test whether operation is identity up to a phase and return phase if so.
 
virtual bool is_clifford () const
 Test whether operation is in the Clifford group.
 
virtual bool has_symmetry (unsigned port1, unsigned port2) const
 Checks for symmetry of port pairs.
 
virtual Eigen::MatrixXcd get_unitary () const
 If meaningful and implemented, return the numerical unitary matrix (in ILO-BE convention) which this Op represents.
 
virtual ~Op ()
 
bool operator== (const Op &other) const
 

Additional Inherited Members

- Static Public Member Functions inherited from tket::ClassicalOp
static Op_ptr deserialize (const nlohmann::json &j)
 
- Protected Member Functions inherited from tket::Op
 Op (const OpType &type)
 
- Protected Attributes inherited from tket::ClassicalOp
const unsigned n_i_
 
const unsigned n_io_
 
const unsigned n_o_
 
const std::string name_
 
std::vector< EdgeTypesig_
 
- Protected Attributes inherited from tket::Op
const OpDesc desc_
 Operation descriptor.
 
const OpType type_
 Operation type.
 

Detailed Description

A classical operation applied simultaneously to multiple bits.

The order of arguments is: all arguments to first operation, then all arguments to second operation, and so on.

Definition at line 477 of file ClassicalOps.hpp.

Constructor & Destructor Documentation

◆ MultiBitOp()

tket::MultiBitOp::MultiBitOp ( std::shared_ptr< const ClassicalEvalOp op,
unsigned  n 
)

Definition at line 373 of file ClassicalOps.cpp.

Member Function Documentation

◆ eval()

std::vector< bool > tket::MultiBitOp::eval ( const std::vector< bool > &  x) const
overridevirtual

Evaluation.

Parameters
xvector of input bits
Returns
vector of outbut bits

Implements tket::ClassicalEvalOp.

Definition at line 394 of file ClassicalOps.cpp.

◆ get_n()

unsigned tket::MultiBitOp::get_n ( ) const
inline

Definition at line 490 of file ClassicalOps.hpp.

◆ get_name()

std::string tket::MultiBitOp::get_name ( bool  latex) const
overridevirtual

String representation.

Reimplemented from tket::ClassicalOp.

Definition at line 388 of file ClassicalOps.cpp.

◆ get_op()

std::shared_ptr< const ClassicalEvalOp > tket::MultiBitOp::get_op ( ) const
inline

Definition at line 488 of file ClassicalOps.hpp.

◆ is_equal()

bool tket::MultiBitOp::is_equal ( const Op other) const
overridevirtual

Equality check between two MultiBitOp instances.

Reimplemented from tket::ClassicalEvalOp.

Definition at line 414 of file ClassicalOps.cpp.

◆ symbol_substitution()

Op_ptr tket::MultiBitOp::symbol_substitution ( const SymEngine::map_basic_basic &  sub_map) const
inlineoverridevirtual

Operation with values for symbols substituted.

Parameters
sub_mapmap from symbols to values
Returns
New operation with symbols substituted, or a null pointer if the operation type does not support symbols.

Implements tket::Op.

Definition at line 481 of file ClassicalOps.hpp.


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