Skip to content

Commit

Permalink
fix(qfasm): parse delay close ScQ-Cloud#188
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhaoyilunnn committed Aug 20, 2024
1 parent 74f01f1 commit 5af7aa6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion quafu/elements/pulses.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from abc import ABC, abstractmethod
from copy import deepcopy
from typing import Optional, Union
from typing import Dict, Optional, Union

import matplotlib.pyplot as plt
import numpy as np
from quafu.elements.instruction import Instruction
from quafu.elements.quantum_gate import QuantumGate

TimeType = Union[np.ndarray, float, int]

Expand Down Expand Up @@ -259,6 +260,14 @@ def __repr__(self):
def to_qasm(self, with_para):
return "delay(%d%s) q[%d]" % (self.duration, self.unit, self.pos)

@property
def named_paras(self) -> Dict:
return {"duration": self.duration}

@property
def named_pos(self) -> Dict:
return {"pos": self.pos}


class XYResonance(Instruction):
name = "XY"
Expand Down
3 changes: 3 additions & 0 deletions quafu/qfasm/qelib1.inc
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,6 @@ gate sw a {}
gate toffoli a,b,c {}
// Fredkin
gate fredkin a,b,c {}

// Delay
gate delay(t) a {}

0 comments on commit 5af7aa6

Please sign in to comment.