-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit ce1cb35.
- Loading branch information
Showing
17 changed files
with
131 additions
and
369 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from bloqade.ir.control.waveform import Waveform, Linear, Constant | ||
from bloqade.builder.typing import ScalarType | ||
from beartype import beartype | ||
from beartype.typing import List | ||
|
||
# this part only for manually build sequences. | ||
|
||
|
||
@beartype | ||
def linear(duration: ScalarType, start: ScalarType, stop: ScalarType): | ||
return Linear(start, stop, duration) | ||
|
||
|
||
@beartype | ||
def constant(duration: ScalarType, value: ScalarType): | ||
return Constant(value, duration) | ||
|
||
|
||
@beartype | ||
def piecewise_linear(durations: List[ScalarType], values: List[ScalarType]) -> Waveform: | ||
pwl_wf = None | ||
for duration, start, stop in zip(durations, values[:-1], values[1:]): | ||
if pwl_wf is None: | ||
pwl_wf = Linear(start, stop, duration) | ||
else: | ||
pwl_wf = pwl_wf.append(Linear(start, stop, duration)) | ||
|
||
return pwl_wf | ||
|
||
|
||
@beartype | ||
def piecewise_constant( | ||
durations: List[ScalarType], values: List[ScalarType] | ||
) -> Waveform: | ||
pwc_wf = None | ||
for duration, value in zip(durations, values): | ||
if pwc_wf is None: | ||
pwc_wf = Constant(value, duration) | ||
else: | ||
pwc_wf = pwc_wf.append(Constant(value, duration)) | ||
|
||
return pwc_wf |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.