tket
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
tket::Unitary2qBox Class Reference

Two-qubit operation defined as a unitary matrix (ILO-BE) More...

#include <Boxes.hpp>

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

Public Member Functions

 Unitary2qBox (const Eigen::Matrix4cd &m, BasisOrder basis=BasisOrder::ilo)
 Construct from a given 4x4 unitary matrix.
 
 Unitary2qBox ()
 Construct from the identity matrix.
 
 Unitary2qBox (const Unitary2qBox &other)
 Copy constructor.
 
 ~Unitary2qBox () override
 
Op_ptr symbol_substitution (const SymEngine::map_basic_basic &) const override
 Operation with values for symbols substituted.
 
SymSet free_symbols () const override
 Set of all free symbols occurring in operation parameters.
 
bool is_equal (const Op &op_other) const override
 Equality check between two Unitary2qBox instances.
 
Eigen::Matrix4cd get_matrix () const
 Get the unitary matrix correspnding to this operation.
 
std::optional< Eigen::MatrixXcd > get_box_unitary () const override
 If meaningful and implemented, return the numerical unitary matrix (in ILO-BE convention) which this Box represents.
 
Op_ptr dagger () const override
 Inverse (of a unitary operation)
 
Op_ptr transpose () const override
 Transpose of a unitary operation.
 
- Public Member Functions inherited from tket::Box
 Box (const OpType &type, const op_signature_t &signature={})
 
 Box (const Box &other)
 
unsigned n_qubits () const override
 Number of Quantum inputs.
 
unsigned n_boolean () const
 Number of Boolean inputs.
 
unsigned n_classical () const
 Number of Classical inputs.
 
op_signature_t get_signature () const override
 Vector specifying type of data for each port on op.
 
nlohmann::json serialize () const override
 
std::shared_ptr< Circuitto_circuit () const
 Circuit represented by box.
 
Eigen::MatrixXcd get_unitary () const override
 If meaningful and implemented, return the numerical unitary matrix (in ILO-BE convention) which this Op represents.
 
boost::uuids::uuid get_id () const
 Unique identifier (preserved on copy)
 
- Public Member Functions inherited from tket::Op
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_name (bool latex=false) const
 String representation.
 
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 ~Op ()
 
bool operator== (const Op &other) const
 

Static Public Member Functions

static Op_ptr from_json (const nlohmann::json &j)
 
static nlohmann::json to_json (const Op_ptr &op)
 
- Static Public Member Functions inherited from tket::Box
static Op_ptr deserialize (const nlohmann::json &j)
 

Protected Member Functions

void generate_circuit () const override
 
- Protected Member Functions inherited from tket::Op
 Op (const OpType &type)
 

Additional Inherited Members

- Static Protected Member Functions inherited from tket::Box
static boost::uuids::uuid idgen ()
 
- Protected Attributes inherited from tket::Box
op_signature_t signature_
 
std::shared_ptr< Circuitcirc_
 
boost::uuids::uuid id_
 
- Protected Attributes inherited from tket::Op
const OpDesc desc_
 Operation descriptor.
 
const OpType type_
 Operation type.
 

Detailed Description

Two-qubit operation defined as a unitary matrix (ILO-BE)

Definition at line 255 of file Boxes.hpp.

Constructor & Destructor Documentation

◆ Unitary2qBox() [1/3]

tket::Unitary2qBox::Unitary2qBox ( const Eigen::Matrix4cd &  m,
BasisOrder  basis = BasisOrder::ilo 
)
explicit

Construct from a given 4x4 unitary matrix.

Parameters
munitary matrix
basisbasis order convention for matrix

Definition at line 182 of file Boxes.cpp.

◆ Unitary2qBox() [2/3]

tket::Unitary2qBox::Unitary2qBox ( )

Construct from the identity matrix.

Definition at line 193 of file Boxes.cpp.

◆ Unitary2qBox() [3/3]

tket::Unitary2qBox::Unitary2qBox ( const Unitary2qBox other)

Copy constructor.

Definition at line 190 of file Boxes.cpp.

◆ ~Unitary2qBox()

tket::Unitary2qBox::~Unitary2qBox ( )
inlineoverride

Definition at line 276 of file Boxes.hpp.

Member Function Documentation

◆ dagger()

Op_ptr tket::Unitary2qBox::dagger ( ) const
overridevirtual

Inverse (of a unitary operation)

Exceptions
BadOpTypeif operation is not unitary

Reimplemented from tket::Op.

Definition at line 195 of file Boxes.cpp.

◆ free_symbols()

SymSet tket::Unitary2qBox::free_symbols ( ) const
inlineoverridevirtual

Set of all free symbols occurring in operation parameters.

Implements tket::Op.

Definition at line 283 of file Boxes.hpp.

◆ from_json()

Op_ptr tket::Unitary2qBox::from_json ( const nlohmann::json &  j)
static

Definition at line 637 of file Boxes.cpp.

◆ generate_circuit()

void tket::Unitary2qBox::generate_circuit ( ) const
overrideprotectedvirtual

Implements tket::Box.

Definition at line 203 of file Boxes.cpp.

◆ get_box_unitary()

std::optional< Eigen::MatrixXcd > tket::Unitary2qBox::get_box_unitary ( ) const
inlineoverridevirtual

If meaningful and implemented, return the numerical unitary matrix (in ILO-BE convention) which this Box represents.

Returns
unitary matrix (ILO-BE) which this Box represents

Reimplemented from tket::Box.

Definition at line 293 of file Boxes.hpp.

◆ get_matrix()

Eigen::Matrix4cd tket::Unitary2qBox::get_matrix ( ) const
inline

Get the unitary matrix correspnding to this operation.

Definition at line 291 of file Boxes.hpp.

◆ is_equal()

bool tket::Unitary2qBox::is_equal ( const Op op_other) const
overridevirtual

Equality check between two Unitary2qBox instances.

Reimplemented from tket::Op.

Definition at line 207 of file Boxes.cpp.

◆ symbol_substitution()

Op_ptr tket::Unitary2qBox::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 278 of file Boxes.hpp.

◆ to_json()

nlohmann::json tket::Unitary2qBox::to_json ( const Op_ptr op)
static

Definition at line 630 of file Boxes.cpp.

◆ transpose()

Op_ptr tket::Unitary2qBox::transpose ( ) const
overridevirtual

Transpose of a unitary operation.

Reimplemented from tket::Op.

Definition at line 199 of file Boxes.cpp.


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