Maestro 0.3.11
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
SimpleOps.h File Reference
#include <cctype>
#include <limits>
#include <string_view>
#include "Expr.h"
Include dependency graph for SimpleOps.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  qasm::AddBarrierExpr
struct  qasm::AddCommentExpr
struct  qasm::AddCregExpr
struct  qasm::AddDeclarationExpr
struct  qasm::AddDelayExpr
struct  qasm::AddGateDeclExpr
struct  qasm::AddInputDeclExpr
struct  qasm::AddMeasureExpr
struct  qasm::AddOpaqueDeclExpr
struct  qasm::AddQregExpr
struct  qasm::AddResetExpr
struct  qasm::CondBitTest
struct  qasm::CondHeadType
struct  qasm::DelayType
class  qasm::IndexedId
struct  qasm::MakeBitCondHeadExpression
struct  qasm::MakeCondBitTestExpression
struct  qasm::MakeCtrlModifierExpression
struct  qasm::MakeDelayExpr
struct  qasm::MakeIndexedIdExpression
struct  qasm::MakePowModifierExpression
struct  qasm::MakeRegCondHeadExpression
struct  qasm::ModifierType
struct  qasm::QoperationStatement
struct  qasm::RejectMeasureWithoutTargetExpr
struct  qasm::MakeIndexedIdExpression::result< typename, typename >
struct  qasm::MakePowModifierExpression::result< typename, typename >
struct  qasm::MakeCtrlModifierExpression::result< typename, typename, typename >
struct  qasm::MakeRegCondHeadExpression::result
struct  qasm::MakeCondBitTestExpression::result
struct  qasm::MakeBitCondHeadExpression::result
struct  qasm::AddCregExpr::result
struct  qasm::AddQregExpr::result
struct  qasm::AddCommentExpr::result
struct  qasm::AddDeclarationExpr::result
struct  qasm::AddInputDeclExpr::result
struct  qasm::AddMeasureExpr::result
struct  qasm::RejectMeasureWithoutTargetExpr::result< typename >
struct  qasm::AddResetExpr::result
struct  qasm::AddBarrierExpr::result
struct  qasm::MakeDelayExpr::result< typename, typename, typename >
struct  qasm::AddDelayExpr::result
struct  qasm::AddOpaqueDeclExpr::result
struct  qasm::AddGateDeclExpr::result

Namespaces

namespace  qasm

Macros

#define _SIMPLEOPS_H_

Typedefs

using qasm::ArgumentType = std::variant<std::string, IndexedId>
using qasm::BarrierType = MixedListType
using qasm::CondOpType = boost::fusion::vector<std::string, int, QopType>
using qasm::CXGateCallType = boost::fusion::vector<ArgumentType, ArgumentType>
using qasm::DeclarationRegistry = std::unordered_map<std::string, DeclarationKind>
using qasm::ExpGatecallType = boost::fusion::vector<std::string, std::vector<Expression>, MixedListType>
using qasm::GatecallType = std::variant<SimpleGatecallType, ExpGatecallType>
using qasm::GateDeclOpType = std::variant<UopType, SimpleBarrierType>
using qasm::GateDeclType = boost::fusion::vector<std::string, std::vector<std::string>, std::vector<std::string>>
using qasm::InputDeclType = boost::fusion::vector<std::string, boost::optional<int>, std::string>
using qasm::MeasureType = boost::fusion::vector<ArgumentType, ArgumentType>
using qasm::MixedListType = std::vector<ArgumentType>
using qasm::ModifiedUopType = boost::fusion::vector<ModifierListType, UopType>
using qasm::ModifierListType = std::vector<ModifierType>
using qasm::OpaqueDeclType = boost::fusion::vector<std::string, std::vector<std::string>, std::vector<std::string>>
using qasm::ProgramType = boost::fusion::vector<std::vector<std::string>, double, std::vector<std::string>, std::vector<StatementType>>
using qasm::QopType = StatementType
using qasm::RegisterMap = std::unordered_map<std::string, IndexedId>
using qasm::ResetType = ArgumentType
using qasm::SimpleBarrierType = std::vector<std::string>
using qasm::SimpleExpType = std::variant<double, int, std::string>
using qasm::SimpleGatecallType = boost::fusion::vector<std::string, MixedListType>
using qasm::StatementType = QoperationStatement
using qasm::UGateCallType = boost::fusion::vector<std::vector<Expression>, ArgumentType>
using qasm::UopType = std::variant<UGateCallType, CXGateCallType, GatecallType>

Enumerations

enum class  qasm::DeclarationKind {
  qasm::Qubit ,
  qasm::Bit ,
  qasm::Input ,
  qasm::Gate ,
  qasm::Opaque
}
enum class  qasm::ModifierKind {
  qasm::Ctrl ,
  qasm::NegCtrl ,
  qasm::Inv ,
  qasm::Pow
}

Functions

std::string_view qasm::DeclarationKindName (DeclarationKind kind)
void qasm::RegisterDeclaration (DeclarationRegistry &declarations, const std::string &name, DeclarationKind kind)
void qasm::RequireMatchingRegisterWidths (const std::vector< int > &left, const std::vector< int > &right, std::string_view operation)
std::vector< int > qasm::ResolveRegisterOperand (const ArgumentType &argument, const RegisterMap &registers, std::string_view kind)
double qasm::ValidateInputBinding (const std::string &name, const std::string &type, const boost::optional< int > &width, double value)
void qasm::ValidateInputDeclaration (const std::string &name, const std::string &type, const boost::optional< int > &width)
int qasm::ValidateRegisterAllocation (const IndexedId &id, int currentSize, std::string_view kind)

Variables

phx::function< AddBarrierExpr > qasm::AddBarrier
phx::function< AddCommentExpr > qasm::AddComment
phx::function< AddCregExpr > qasm::AddCreg
phx::function< AddDeclarationExpr > qasm::AddDeclaration
phx::function< AddDelayExpr > qasm::AddDelay
phx::function< AddGateDeclExpr > qasm::AddGateDecl
phx::function< AddInputDeclExpr > qasm::AddInputDecl
phx::function< AddMeasureExpr > qasm::AddMeasure
phx::function< AddOpaqueDeclExpr > qasm::AddOpaqueDecl
phx::function< AddQregExpr > qasm::AddQreg
phx::function< AddResetExpr > qasm::AddReset
phx::function< MakeBitCondHeadExpression > qasm::MakeBitCondHead
phx::function< MakeCondBitTestExpression > qasm::MakeCondBitTest
phx::function< MakeCtrlModifierExpression > qasm::MakeCtrlModifier
phx::function< MakeDelayExpr > qasm::MakeDelay
phx::function< MakeIndexedIdExpression > qasm::MakeIndexedId
phx::function< MakePowModifierExpression > qasm::MakePowModifier
phx::function< MakeRegCondHeadExpression > qasm::MakeRegCondHead
phx::function< RejectMeasureWithoutTargetExpr > qasm::RejectMeasureWithoutTarget

Detailed Description

Version
1.0

DESCRIPTION

Classes for the qasm parser and interpreter, dealing with the simple declarations and operations.

It's supposed to support only open qasm 2.0.

Definition in file SimpleOps.h.


Class Documentation

◆ qasm::CondBitTest

struct qasm::CondBitTest

Definition at line 354 of file SimpleOps.h.

Collaboration diagram for qasm::CondBitTest:
Class Members
IndexedId bit
bool expected = true

◆ qasm::CondHeadType

struct qasm::CondHeadType

Definition at line 360 of file SimpleOps.h.

Collaboration diagram for qasm::CondHeadType:
Class Members
vector< CondBitTest > bits
bool isBitForm = false
string regId
int regValue = 0

◆ qasm::DelayType

struct qasm::DelayType

Definition at line 325 of file SimpleOps.h.

Collaboration diagram for qasm::DelayType:
Class Members
double duration = 0.0
MixedListType operands

◆ qasm::MakeIndexedIdExpression::result

struct qasm::MakeIndexedIdExpression::result
template<typename, typename>
struct qasm::MakeIndexedIdExpression::result< typename, typename >

Definition at line 116 of file SimpleOps.h.

Collaboration diagram for qasm::MakeIndexedIdExpression::result< typename, typename >:
Class Members
typedef IndexedId type

◆ qasm::MakePowModifierExpression::result

struct qasm::MakePowModifierExpression::result
template<typename, typename>
struct qasm::MakePowModifierExpression::result< typename, typename >

Definition at line 217 of file SimpleOps.h.

Collaboration diagram for qasm::MakePowModifierExpression::result< typename, typename >:
Class Members
typedef ModifierType type

◆ qasm::MakeCtrlModifierExpression::result

struct qasm::MakeCtrlModifierExpression::result
template<typename, typename, typename>
struct qasm::MakeCtrlModifierExpression::result< typename, typename, typename >

Definition at line 249 of file SimpleOps.h.

Collaboration diagram for qasm::MakeCtrlModifierExpression::result< typename, typename, typename >:
Class Members
typedef ModifierType type

◆ qasm::MakeRegCondHeadExpression::result

struct qasm::MakeRegCondHeadExpression::result

Definition at line 372 of file SimpleOps.h.

Collaboration diagram for qasm::MakeRegCondHeadExpression::result:
Class Members
typedef CondHeadType type

◆ qasm::MakeCondBitTestExpression::result

struct qasm::MakeCondBitTestExpression::result

Definition at line 391 of file SimpleOps.h.

Collaboration diagram for qasm::MakeCondBitTestExpression::result:
Class Members
typedef CondBitTest type

◆ qasm::MakeBitCondHeadExpression::result

struct qasm::MakeBitCondHeadExpression::result

Definition at line 409 of file SimpleOps.h.

Collaboration diagram for qasm::MakeBitCondHeadExpression::result:
Class Members
typedef CondHeadType type

◆ qasm::AddCregExpr::result

struct qasm::AddCregExpr::result

Definition at line 432 of file SimpleOps.h.

Collaboration diagram for qasm::AddCregExpr::result:
Class Members
typedef IndexedId type

◆ qasm::AddQregExpr::result

struct qasm::AddQregExpr::result

Definition at line 457 of file SimpleOps.h.

Collaboration diagram for qasm::AddQregExpr::result:
Class Members
typedef IndexedId type

◆ qasm::AddCommentExpr::result

struct qasm::AddCommentExpr::result

Definition at line 482 of file SimpleOps.h.

Collaboration diagram for qasm::AddCommentExpr::result:
Class Members
typedef QoperationStatement type

◆ qasm::AddDeclarationExpr::result

struct qasm::AddDeclarationExpr::result

Definition at line 502 of file SimpleOps.h.

Collaboration diagram for qasm::AddDeclarationExpr::result:
Class Members
typedef QoperationStatement type

◆ qasm::AddInputDeclExpr::result

struct qasm::AddInputDeclExpr::result

Definition at line 606 of file SimpleOps.h.

Collaboration diagram for qasm::AddInputDeclExpr::result:
Class Members
typedef QoperationStatement type

◆ qasm::AddMeasureExpr::result

struct qasm::AddMeasureExpr::result

Definition at line 644 of file SimpleOps.h.

Collaboration diagram for qasm::AddMeasureExpr::result:
Class Members
typedef QoperationStatement type

◆ qasm::RejectMeasureWithoutTargetExpr::result

struct qasm::RejectMeasureWithoutTargetExpr::result
template<typename>
struct qasm::RejectMeasureWithoutTargetExpr::result< typename >

Definition at line 677 of file SimpleOps.h.

Collaboration diagram for qasm::RejectMeasureWithoutTargetExpr::result< typename >:
Class Members
typedef QoperationStatement type

◆ qasm::AddResetExpr::result

struct qasm::AddResetExpr::result

Definition at line 694 of file SimpleOps.h.

Collaboration diagram for qasm::AddResetExpr::result:
Class Members
typedef QoperationStatement type

◆ qasm::AddBarrierExpr::result

struct qasm::AddBarrierExpr::result

Definition at line 712 of file SimpleOps.h.

Collaboration diagram for qasm::AddBarrierExpr::result:
Class Members
typedef QoperationStatement type

◆ qasm::MakeDelayExpr::result

struct qasm::MakeDelayExpr::result
template<typename, typename, typename>
struct qasm::MakeDelayExpr::result< typename, typename, typename >

Definition at line 749 of file SimpleOps.h.

Collaboration diagram for qasm::MakeDelayExpr::result< typename, typename, typename >:
Class Members
typedef DelayType type

◆ qasm::AddDelayExpr::result

struct qasm::AddDelayExpr::result

Definition at line 773 of file SimpleOps.h.

Collaboration diagram for qasm::AddDelayExpr::result:
Class Members
typedef QoperationStatement type

◆ qasm::AddOpaqueDeclExpr::result

struct qasm::AddOpaqueDeclExpr::result

Definition at line 796 of file SimpleOps.h.

Collaboration diagram for qasm::AddOpaqueDeclExpr::result:
Class Members
typedef QoperationStatement type

◆ qasm::AddGateDeclExpr::result

struct qasm::AddGateDeclExpr::result

Definition at line 830 of file SimpleOps.h.

Collaboration diagram for qasm::AddGateDeclExpr::result:
Class Members
typedef QoperationStatement type

Macro Definition Documentation

◆ _SIMPLEOPS_H_

#define _SIMPLEOPS_H_

Definition at line 16 of file SimpleOps.h.