Maestro 0.3.1
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
using qasm::GatecallType = std::variant<SimpleGatecallType, ExpGatecallType>
using qasm::GateDeclOpType = std::variant<UopType, SimpleBarrierType>
using qasm::GateDeclType
using qasm::InputDeclType
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
using qasm::ProgramType
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
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< AddBarrierExprqasm::AddBarrier
phx::function< AddCommentExprqasm::AddComment
phx::function< AddCregExprqasm::AddCreg
phx::function< AddDeclarationExprqasm::AddDeclaration
phx::function< AddDelayExprqasm::AddDelay
phx::function< AddGateDeclExprqasm::AddGateDecl
phx::function< AddInputDeclExprqasm::AddInputDecl
phx::function< AddMeasureExprqasm::AddMeasure
phx::function< AddOpaqueDeclExprqasm::AddOpaqueDecl
phx::function< AddQregExprqasm::AddQreg
phx::function< AddResetExprqasm::AddReset
phx::function< MakeBitCondHeadExpressionqasm::MakeBitCondHead
phx::function< MakeCondBitTestExpressionqasm::MakeCondBitTest
phx::function< MakeCtrlModifierExpressionqasm::MakeCtrlModifier
phx::function< MakeDelayExprqasm::MakeDelay
phx::function< MakeIndexedIdExpressionqasm::MakeIndexedId
phx::function< MakePowModifierExpressionqasm::MakePowModifier
phx::function< MakeRegCondHeadExpressionqasm::MakeRegCondHead
phx::function< RejectMeasureWithoutTargetExprqasm::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 330 of file SimpleOps.h.

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

◆ qasm::CondHeadType

struct qasm::CondHeadType

Definition at line 335 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 303 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 97 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 197 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 228 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 345 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 361 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 376 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 400 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 425 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 450 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 467 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 572 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 610 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 645 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 660 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 676 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 709 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 732 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 753 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 787 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.