コード例 #1
0
        private static QVoid ExecuteConditionalStatementInternal(QuantumProcessorDispatcher Simulator,
                                                                 long statement,
                                                                 ICallable onEqualOp,
                                                                 ICallable onNonEqualOp,
                                                                 OperationFunctor type,
                                                                 IQArray <Qubit>?ctrls)
        {
            bool run;

            run = Simulator.QuantumProcessor.RunThenClause(statement);
            while (run)
            {
                RunClause(onEqualOp, type, ctrls);
                run = Simulator.QuantumProcessor.RepeatThenClause(statement);
            }

            run = Simulator.QuantumProcessor.RunElseClause(statement);
            while (run)
            {
                RunClause(onNonEqualOp, type, ctrls);
                run = Simulator.QuantumProcessor.RepeatElseClause(statement);
            }

            Simulator.QuantumProcessor.EndConditionalStatement(statement);

            return(QVoid.Instance);
        }
コード例 #2
0
        private static QVoid ExecuteConditionalStatement(QuantumProcessorDispatcher Simulator,
                                                         Result measurementResult,
                                                         Result resultValue,
                                                         ICallable onEqualOp,
                                                         ICallable onNonEqualOp,
                                                         OperationFunctor type,
                                                         IQArray <Qubit>?ctrls)
        {
            long statement = Simulator.QuantumProcessor.StartConditionalStatement(measurementResult, resultValue);

            return(ExecuteConditionalStatementInternal(Simulator,
                                                       statement,
                                                       onEqualOp,
                                                       onNonEqualOp,
                                                       type,
                                                       ctrls));
        }
コード例 #3
0
 public QuantumProcessorDispatcherM(QuantumProcessorDispatcher m) : base(m)
 {
     this.Simulator = m;
 }
コード例 #4
0
 public QuantumProcessorDispatcherAllocate(QuantumProcessorDispatcher m) : base(m)
 {
     sim = m;
 }
コード例 #5
0
ファイル: Dump.cs プロジェクト: RachelGuo76/qsharp-runtime
 public QuantumProcessorDispatcherDumpRegister(QuantumProcessorDispatcher m) : base(m)
 {
     this.Simulator = m;
 }
コード例 #6
0
ファイル: Dump.cs プロジェクト: RachelGuo76/qsharp-runtime
 public QuantumProcessorDispatcherDumpMachine(QuantumProcessorDispatcher m) : base(m)
 {
     this.Simulator = m;
 }
コード例 #7
0
 public QuantumProcessorDispatcherRandom(QuantumProcessorDispatcher m) : base(m)
 {
     Simulator = m;
 }
コード例 #8
0
 public QuantumProcessorDispatcherReturn(QuantumProcessorDispatcher m) : base(m)
 {
     sim = m;
 }
コード例 #9
0
ファイル: Borrow.cs プロジェクト: mirounga/qsharp-runtime
 public QuantumProcessorDispatcherBorrow(QuantumProcessorDispatcher m) : base(m)
 {
     sim = m;
 }