diff --git a/src/Core/ExecutionPathTracer/ExecutionPath.cs b/src/Core/ExecutionPathTracer/ExecutionPath.cs index 1cc533db6d..95ca7e83e5 100644 --- a/src/Core/ExecutionPathTracer/ExecutionPath.cs +++ b/src/Core/ExecutionPathTracer/ExecutionPath.cs @@ -123,17 +123,23 @@ public class Operation [JsonProperty("children")] public IEnumerable>? Children { get; set; } + /// + /// True if operation is a measurement operations. + /// + [JsonProperty("isMeasurement")] + public bool IsMeasurement { get; set; } + /// /// True if operation is a controlled operations. /// - [JsonProperty("controlled")] - public bool Controlled { get; set; } + [JsonProperty("isControlled")] + public bool IsControlled { get; set; } /// /// True if operation is an adjoint operations. /// - [JsonProperty("adjoint")] - public bool Adjoint { get; set; } + [JsonProperty("isAdjoint")] + public bool IsAdjoint { get; set; } /// /// List of control registers. diff --git a/src/Core/ExecutionPathTracer/ExecutionPathTracer.cs b/src/Core/ExecutionPathTracer/ExecutionPathTracer.cs index a02e5e37bc..b3fef025cc 100644 --- a/src/Core/ExecutionPathTracer/ExecutionPathTracer.cs +++ b/src/Core/ExecutionPathTracer/ExecutionPathTracer.cs @@ -148,8 +148,8 @@ private ClassicalRegister GetClassicalRegister(Qubit controlQubit) Gate = metadata.Label, DisplayArgs = displayArgs, Children = metadata.Children?.Select(child => child.Select(this.MetadataToOperation).WhereNotNull()), - Controlled = metadata.IsControlled, - Adjoint = metadata.IsAdjoint, + IsControlled = metadata.IsControlled, + IsAdjoint = metadata.IsAdjoint, Controls = this.GetQubitRegisters(metadata.Controls), Targets = this.GetQubitRegisters(metadata.Targets), }; @@ -159,8 +159,7 @@ private ClassicalRegister GetClassicalRegister(Qubit controlQubit) { var measureQubit = metadata.Targets.ElementAt(0); var clsReg = this.CreateClassicalRegister(measureQubit); - // TODO: Change this to using IsMeasurement - op.Gate = "measure"; + op.IsMeasurement = true; op.Controls = op.Targets; op.Targets = new List() { clsReg }; } diff --git a/src/Kernel/client/ExecutionPathVisualizer/executionPath.ts b/src/Kernel/client/ExecutionPathVisualizer/executionPath.ts index eb74cb57f6..3b8cbfed46 100644 --- a/src/Kernel/client/ExecutionPathVisualizer/executionPath.ts +++ b/src/Kernel/client/ExecutionPathVisualizer/executionPath.ts @@ -32,10 +32,12 @@ export interface Operation { * - children[1]: gates when classical control bit is 1. */ children?: Operation[][]; + /** Whether gate is a measurement operation. */ + isMeasurement: boolean; /** Whether gate is a controlled operation. */ - controlled: boolean; + isControlled: boolean; /** Whether gate is an adjoint operation. */ - adjoint: boolean; + isAdjoint: boolean; /** Control registers the gate acts on. */ controls: Register[]; /** Target registers the gate acts on. */ diff --git a/src/Kernel/client/ExecutionPathVisualizer/process.ts b/src/Kernel/client/ExecutionPathVisualizer/process.ts index 14c94f8104..5d81e9f854 100644 --- a/src/Kernel/client/ExecutionPathVisualizer/process.ts +++ b/src/Kernel/client/ExecutionPathVisualizer/process.ts @@ -185,7 +185,16 @@ const _opToMetadata = (op: Operation | null, registers: RegisterMap): Metadata = if (op == null) return metadata; - let { gate, displayArgs, controlled, adjoint, controls, targets, children } = op; + let { + gate, + displayArgs, + isMeasurement, + isControlled, + isAdjoint, + controls, + targets, + children + } = op; // Set y coords metadata.controlsY = controls.map(reg => _getRegY(reg, registers)); @@ -216,11 +225,11 @@ const _opToMetadata = (op: Operation | null, registers: RegisterMap): Metadata = // around all quantum registers. const qubitsY: number[] = Object.values(registers).map(({ y }) => y); metadata.targetsY = [Math.min(...qubitsY), Math.max(...qubitsY)]; - } else if (gate === 'measure') { + } else if (isMeasurement) { metadata.type = GateType.Measure; } else if (gate === 'SWAP') { metadata.type = GateType.Swap; - } else if (controlled) { + } else if (isControlled) { metadata.type = (gate === 'X') ? GateType.Cnot : GateType.ControlledUnitary; metadata.label = gate; } else { @@ -230,7 +239,7 @@ const _opToMetadata = (op: Operation | null, registers: RegisterMap): Metadata = } // If adjoint, add ' to the end of gate label - if (adjoint && metadata.label.length > 0) metadata.label += "'"; + if (isAdjoint && metadata.label.length > 0) metadata.label += "'"; // If gate has extra arguments, display them if (displayArgs != null) metadata.displayArgs = displayArgs; diff --git a/src/Kernel/client/__tests__/ExecutionPathVisualizerTests/process.test.ts b/src/Kernel/client/__tests__/ExecutionPathVisualizerTests/process.test.ts index b5a6870d2d..ece1c6ed4d 100644 --- a/src/Kernel/client/__tests__/ExecutionPathVisualizerTests/process.test.ts +++ b/src/Kernel/client/__tests__/ExecutionPathVisualizerTests/process.test.ts @@ -34,62 +34,62 @@ describe("Testing _groupOperations", () => { }; test("single qubit gates on 1 qubit register", () => { const operations: Operation[] = [ - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Y", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Z", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Y", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Z", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 1, 2], [], [], []]); }); test("single qubit gates on multiple qubit registers", () => { const operations: Operation[] = [ - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Y", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "Z", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, - { gate: "H", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "T", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Y", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "Z", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, + { gate: "H", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "T", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 3], [1, 4], [2], []]); }); test("single and multiple qubit(s) gates", () => { let operations: Operation[] = [ - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Y", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "Z", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Y", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "Z", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 1, 2], [1], [], []]); operations = [ - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Y", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Z", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Y", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Z", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 1, 2], [1], [], []]); operations = [ - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Z", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Y", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Z", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Y", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 1, 2], [2], [], []]); operations = [ - { gate: "Y", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Z", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Y", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Z", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 1, 2], [0], [], []]); operations = [ - { gate: "Y", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Z", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "Y", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Z", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 1], [0, 2], [], []]); }); test("multiple qubit gates in ladder format", () => { const operations: Operation[] = [ - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Y", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, - { gate: "Z", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, - { gate: "H", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, - { gate: "T", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Y", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, + { gate: "Z", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, + { gate: "H", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, + { gate: "T", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 5], [0, 1, 4, 5], [1, 2, 3, 4], [2, 3]]); @@ -97,48 +97,48 @@ describe("Testing _groupOperations", () => { test("multiple qubit gates in ladder format with single qubit gate", () => { let numRegs: number = 4; let operations: Operation[] = [ - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Y", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "Y", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, - { gate: "Z", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, - { gate: "Z", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, - { gate: "H", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, - { gate: "T", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "Y", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Y", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "Y", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, + { gate: "Z", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, + { gate: "Z", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, + { gate: "H", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, + { gate: "T", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "Y", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 8], [0, 1, 2, 6, 7, 8], [2, 3, 4, 5, 6], [3, 5]]); numRegs = 3; operations = [ - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Y", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "Y", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, - { gate: "Z", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, - { gate: "T", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "Y", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "H", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "H", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "H", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "H", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Y", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "Y", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, + { gate: "Z", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, + { gate: "T", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 2 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "Y", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "H", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "H", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "H", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "H", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 6, 7, 8, 9, 10], [0, 1, 2, 4, 5, 10], [2, 3, 4], []]); }); test("interleaved multiqubit gates", () => { let operations: Operation[] = [ - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[1], [0, 1], [0, 1], [0]]); operations = [ - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }, { type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 2 }, { type: RegisterType.Qubit, qId: 3 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }, { type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 3 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 2 }, { type: RegisterType.Qubit, qId: 3 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 1], [0, 1], [0, 1], [0, 1]]); operations = [ - { gate: "Foo", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }, { type: RegisterType.Qubit, qId: 2 }, { type: RegisterType.Qubit, qId: 3 }] }, - { gate: "Bar", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }, { type: RegisterType.Qubit, qId: 1 }, { type: RegisterType.Qubit, qId: 2 }] }, + { gate: "Foo", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }, { type: RegisterType.Qubit, qId: 2 }, { type: RegisterType.Qubit, qId: 3 }] }, + { gate: "Bar", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }, { type: RegisterType.Qubit, qId: 1 }, { type: RegisterType.Qubit, qId: 2 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 1], [0, 1], [0, 1], [0]]); }); @@ -158,37 +158,37 @@ describe("Testing _groupOperations", () => { 3: { type: RegisterType.Qubit, y: startY + registerHeight + classicalRegHeight * 4 }, } let operations: Operation[] = [ - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Classical, qId: 2, cId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Classical, qId: 2, cId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0, 1], [0], [0], [0]]); operations = [ - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Classical, qId: 2, cId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Classical, qId: 2, cId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0], [0, 1], [0], [0]]); operations = [ - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Classical, qId: 1, cId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Classical, qId: 1, cId: 0 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[1], [0, 1], [1], [1]]); }); test("skipped registers", () => { let operations: Operation[] = [ - { gate: "X", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Z", controlled: false, adjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, + { gate: "X", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Z", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0], [], [1], []]); operations = [ - { gate: "X", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, - { gate: "Z", controlled: true, adjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, + { gate: "X", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, + { gate: "Z", isMeasurement: false, isControlled: true, isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, ]; expect(_groupOperations(operations, registers)).toEqual([[0], [0, 1], [1], []]); }); test("no qubits", () => { const operations: Operation[] = [ - { gate: "NoOp1", controlled: false, adjoint: false, controls: [], targets: [] }, - { gate: "NoOp2", controlled: false, adjoint: false, controls: [], targets: [] }, + { gate: "NoOp1", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [] }, + { gate: "NoOp2", isMeasurement: false, isControlled: false, isAdjoint: false, controls: [], targets: [] }, ]; expect(_groupOperations(operations, registers)).toEqual([[], [], [], []]); }); @@ -262,8 +262,9 @@ describe("Testing _opToMetadata", () => { test("single qubit gate", () => { const op: Operation = { gate: "X", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }; @@ -281,11 +282,12 @@ describe("Testing _opToMetadata", () => { }; expect(_opToMetadata(op, registers)).toEqual(metadata); }); - test("adjoint gate", () => { + test("isAdjoint gate", () => { const op: Operation = { gate: "Foo", - controlled: false, - adjoint: true, + isMeasurement: false, + isControlled: false, + isAdjoint: true, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }; @@ -305,9 +307,10 @@ describe("Testing _opToMetadata", () => { }); test("measure gate", () => { const op: Operation = { - gate: "measure", - controlled: false, - adjoint: false, + gate: "M", + isMeasurement: true, + isControlled: false, + isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Classical, qId: 0, cId: 0 }] }; @@ -327,8 +330,9 @@ describe("Testing _opToMetadata", () => { test("swap gate", () => { const op: Operation = { gate: "SWAP", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [ { type: RegisterType.Qubit, qId: 0 }, @@ -349,11 +353,12 @@ describe("Testing _opToMetadata", () => { }; expect(_opToMetadata(op, registers)).toEqual(metadata); }); - test("controlled swap gate", () => { + test("isControlled swap gate", () => { const op: Operation = { gate: "SWAP", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [ { type: RegisterType.Qubit, qId: 1 }, @@ -378,8 +383,9 @@ describe("Testing _opToMetadata", () => { test("single qubit unitary gate", () => { const op: Operation = { gate: "X", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }; @@ -404,8 +410,9 @@ describe("Testing _opToMetadata", () => { }; let op: Operation = { gate: "ZZ", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [ { type: RegisterType.Qubit, qId: 0 }, @@ -423,8 +430,9 @@ describe("Testing _opToMetadata", () => { expect(_opToMetadata(op, registers)).toEqual(metadata); op = { gate: "XX", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [ { type: RegisterType.Qubit, qId: 1 }, @@ -441,7 +449,7 @@ describe("Testing _opToMetadata", () => { }; expect(_opToMetadata(op, registers)).toEqual(metadata); }); - test("controlled unitary gates", () => { + test("isControlled unitary gates", () => { const registers: RegisterMap = { 0: { type: RegisterType.Qubit, y: startY }, 1: { type: RegisterType.Qubit, y: startY + registerHeight }, @@ -450,8 +458,9 @@ describe("Testing _opToMetadata", () => { }; let op: Operation = { gate: "ZZ", - controlled: true, - adjoint: false, + isMeasurement: false, + isControlled: true, + isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }; @@ -466,8 +475,9 @@ describe("Testing _opToMetadata", () => { expect(_opToMetadata(op, registers)).toEqual(metadata); op = { gate: "XX", - controlled: true, - adjoint: false, + isMeasurement: false, + isControlled: true, + isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [ { type: RegisterType.Qubit, qId: 1 }, @@ -485,8 +495,9 @@ describe("Testing _opToMetadata", () => { expect(_opToMetadata(op, registers)).toEqual(metadata); op = { gate: "Foo", - controlled: true, - adjoint: false, + isMeasurement: false, + isControlled: true, + isAdjoint: false, controls: [ { type: RegisterType.Qubit, qId: 2 }, { type: RegisterType.Qubit, qId: 3 }, @@ -514,8 +525,9 @@ describe("Testing _opToMetadata", () => { let op: Operation = { gate: "RX", displayArgs: "(0.25)", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }; @@ -534,8 +546,9 @@ describe("Testing _opToMetadata", () => { op = { gate: "RX", displayArgs: "(0.25, 1.0, 'foobar', (3.14, 6.67))", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }; @@ -550,12 +563,13 @@ describe("Testing _opToMetadata", () => { }; expect(_opToMetadata(op, registers)).toEqual(metadata); - // Test controlled + // Test isControlled op = { gate: "RX", displayArgs: "(0.25)", - controlled: true, - adjoint: false, + isMeasurement: false, + isControlled: true, + isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }; @@ -579,8 +593,9 @@ describe("Testing _opToMetadata", () => { let op: Operation = { gate: "U", displayArgs: "('foo', 'bar')", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [ { type: RegisterType.Qubit, qId: 0 }, @@ -602,8 +617,9 @@ describe("Testing _opToMetadata", () => { op = { gate: "U", displayArgs: "(0.25, 1.0, 'foobar', (3.14, 6.67))", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [ { type: RegisterType.Qubit, qId: 0 }, @@ -621,12 +637,13 @@ describe("Testing _opToMetadata", () => { }; expect(_opToMetadata(op, registers)).toEqual(metadata); - // Test controlled + // Test isControlled op = { gate: "U", displayArgs: "('foo', 'bar')", - controlled: true, - adjoint: false, + isMeasurement: false, + isControlled: true, + isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [ { type: RegisterType.Qubit, qId: 0 }, @@ -644,11 +661,12 @@ describe("Testing _opToMetadata", () => { }; expect(_opToMetadata(op, registers)).toEqual(metadata); }); - test("classically controlled gates", () => { + test("classically isControlled gates", () => { const op: Operation = { gate: "X", - controlled: true, - adjoint: false, + isMeasurement: false, + isControlled: true, + isAdjoint: false, controls: [{ type: RegisterType.Classical, qId: 0, cId: 0 }], targets: [ { type: RegisterType.Qubit, qId: 0 }, @@ -657,15 +675,17 @@ describe("Testing _opToMetadata", () => { children: [ [{ gate: "X", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }], [{ gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }] @@ -717,8 +737,9 @@ describe("Testing _opToMetadata", () => { test("Invalid register", () => { let op: Operation = { gate: "X", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }; @@ -730,8 +751,9 @@ describe("Testing _opToMetadata", () => { op = { gate: "X", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [{ type: RegisterType.Classical, qId: 0, cId: 2 }], targets: [] }; @@ -741,8 +763,9 @@ describe("Testing _opToMetadata", () => { test("skipped registers", () => { const op: Operation = { gate: "X", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 2 }] }; @@ -1055,7 +1078,7 @@ describe("Testing _offsetChildrenX", () => { }); describe("Testing _fillMetadataX", () => { - test("Non-classically-controlled gate", () => { + test("Non-classically-isControlled gate", () => { const columnWidths: number[] = Array(1).fill(minGateWidth); const expectedEndX = startX + minGateWidth + gatePadding * 2; const opsMetadata: Metadata[][] = [ @@ -1082,7 +1105,7 @@ describe("Testing _fillMetadataX", () => { expect(opsMetadata).toEqual(expected); expect(endX).toEqual(expectedEndX); }); - test("classically-controlled gate with no children", () => { + test("classically-isControlled gate with no children", () => { const columnWidths: number[] = Array(1).fill(minGateWidth); const expectedEndX = startX + minGateWidth + gatePadding * 2; const opsMetadata: Metadata[][] = [ @@ -1171,30 +1194,34 @@ describe("Testing processOperations", () => { const operations: Operation[] = [ { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, { gate: "RX", displayArgs: "(0.25)", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, @@ -1248,22 +1275,25 @@ describe("Testing processOperations", () => { const operations: Operation[] = [ { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, { gate: "FooBar", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, @@ -1307,22 +1337,25 @@ describe("Testing processOperations", () => { const operations: Operation[] = [ { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, { gate: "X", - controlled: true, - adjoint: false, + isMeasurement: false, + isControlled: true, + isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 1 }], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, @@ -1366,29 +1399,33 @@ describe("Testing processOperations", () => { const operations: Operation[] = [ { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, { - gate: "measure", - controlled: false, - adjoint: false, + gate: "M", + isMeasurement: true, + isControlled: false, + isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Classical, qId: 0, cId: 0 }] }, { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 1 }] }, { - gate: "measure", - controlled: false, - adjoint: false, + gate: "M", + isMeasurement: true, + isControlled: false, + isAdjoint: false, controls: [{ type: RegisterType.Qubit, qId: 0 }], targets: [{ type: RegisterType.Classical, qId: 0, cId: 1 }] }, @@ -1447,15 +1484,17 @@ describe("Testing processOperations", () => { const operations: Operation[] = [ { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 0 }] }, { gate: "H", - controlled: false, - adjoint: false, + isMeasurement: false, + isControlled: false, + isAdjoint: false, controls: [], targets: [{ type: RegisterType.Qubit, qId: 2 }] }, diff --git a/src/Tests/ExecutionPathTracerTests.cs b/src/Tests/ExecutionPathTracerTests.cs index 3dcbc8dad3..3397bd1169 100644 --- a/src/Tests/ExecutionPathTracerTests.cs +++ b/src/Tests/ExecutionPathTracerTests.cs @@ -74,7 +74,8 @@ public void MTest() { new Operation() { - Gate = "measure", + Gate = "M", + IsMeasurement = true, Controls = new List() { new QubitRegister(0) }, Targets = new List() { new ClassicalRegister(0, 0) }, }, @@ -97,7 +98,7 @@ public void CnotTest() new Operation() { Gate = "X", - Controlled = true, + IsControlled = true, Controls = new List() { new QubitRegister(0) }, Targets = new List() { new QubitRegister(1) }, }, @@ -126,7 +127,7 @@ public void CcnotTest() new Operation() { Gate = "X", - Controlled = true, + IsControlled = true, Controls = new List() { new QubitRegister(0), new QubitRegister(2) }, Targets = new List() { new QubitRegister(1) }, }, @@ -205,7 +206,7 @@ public void AdjointHTest() new Operation() { Gate = "H", - Adjoint = true, + IsAdjoint = true, Targets = new List() { new QubitRegister(0) }, }, new Operation() @@ -232,7 +233,7 @@ public void ControlledXTest() new Operation() { Gate = "X", - Controlled = true, + IsControlled = true, Controls = new List() { new QubitRegister(0) }, Targets = new List() { new QubitRegister(1) }, }, @@ -264,8 +265,8 @@ public void ControlledAdjointSTest() new Operation() { Gate = "S", - Controlled = true, - Adjoint = true, + IsControlled = true, + IsAdjoint = true, Controls = new List() { new QubitRegister(0) }, Targets = new List() { new QubitRegister(1) }, }, @@ -319,7 +320,7 @@ public void ControlledFooTest() { Gate = "Foo", DisplayArgs = "(2.1, (\"bar\"))", - Controlled = true, + IsControlled = true, Controls = new List() { new QubitRegister(0) }, Targets = new List() { new QubitRegister(1) }, }, @@ -342,7 +343,7 @@ public void UnusedQubitTest() new Operation() { Gate = "X", - Controlled = true, + IsControlled = true, Controls = new List() { new QubitRegister(2) }, Targets = new List() { new QubitRegister(0) }, }, @@ -403,7 +404,7 @@ public void PartialOpTest() new Operation() { Gate = "H", - Controlled = true, + IsControlled = true, Controls = new List() { new QubitRegister(0), new QubitRegister(1) }, Targets = new List() { new QubitRegister(2) }, }, @@ -539,14 +540,14 @@ public void BigTest() new Operation() { Gate = "X", - Controlled = true, + IsControlled = true, Controls = new List() { new QubitRegister(0), new QubitRegister(1) }, Targets = new List() { new QubitRegister(2) }, }, new Operation() { Gate = "X", - Controlled = true, + IsControlled = true, Controls = new List() { new QubitRegister(0), new QubitRegister(1) }, Targets = new List() { new QubitRegister(2) }, }, @@ -554,14 +555,15 @@ public void BigTest() { Gate = "Bar", DisplayArgs = "((1, 2.1), (\"foo\"))", - Controlled = true, - Adjoint = true, + IsControlled = true, + IsAdjoint = true, Controls = new List() { new QubitRegister(2) }, Targets = new List() { new QubitRegister(0) }, }, new Operation() { - Gate = "measure", + Gate = "M", + IsMeasurement = true, Controls = new List() { new QubitRegister(0) }, Targets = new List() { new ClassicalRegister(0, 0) }, }, @@ -595,7 +597,8 @@ public void MResetXTest() { new Operation() { - Gate = "measure", + Gate = "MResetX", + IsMeasurement = true, Controls = new List() { new QubitRegister(0) }, Targets = new List() { new ClassicalRegister(0, 0) }, }, @@ -616,7 +619,8 @@ public void MResetYTest() { new Operation() { - Gate = "measure", + Gate = "MResetY", + IsMeasurement = true, Controls = new List() { new QubitRegister(0) }, Targets = new List() { new ClassicalRegister(0, 0) }, }, @@ -637,7 +641,8 @@ public void MResetZTest() { new Operation() { - Gate = "measure", + Gate = "MResetZ", + IsMeasurement = true, Controls = new List() { new QubitRegister(0) }, Targets = new List() { new ClassicalRegister(0, 0) }, },