Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add waveform templates #369

Merged
merged 10 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ jobs:
- stable

steps:
# Some of the snapshots have long file paths, so we need to enable long file paths on Windows where the limit is 260 by default
- name: Allow Long File Paths
if: matrix.os == 'windows-latest'
run: |
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
# https://github.com/actions/checkout/issues/1285#issuecomment-2042579471
git config --system core.longpaths true
- name: Checkout sources
uses: actions/checkout@v2
with:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/publish-quil-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ jobs:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
target: [x64]
steps:
steps:
# Some of the snapshots have long file paths, so we need to enable long file paths on Windows where the limit is 260 by default
- name: Allow Long File Paths
run: |
reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
# https://github.com/actions/checkout/issues/1285#issuecomment-2042579471
git config --system core.longpaths true
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
Expand Down
126 changes: 126 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions quil-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ serde = { version = "1.0.125", features = ["derive"] }
strum.workspace = true
thiserror = "1.0.56"
indexmap.workspace = true
statrs = "0.16.0"

[dev-dependencies]
clap = { version = "4.3.19", features = ["derive", "string"] }
Expand All @@ -34,6 +35,7 @@ petgraph = "0.6.2"
proptest = "1.0.0"
proptest-derive = "0.3.0"
rand = "0.8.5"
rasciigraph = "0.2.0"
rstest = "0.18.2"

# These are described in the crate README.md
Expand Down
2 changes: 2 additions & 0 deletions quil-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub(crate) mod parser;
pub mod program;
pub mod quil;
pub mod reserved;
pub mod units;
pub mod validation;
pub mod waveform;

pub use program::Program;
17 changes: 17 additions & 0 deletions quil-rs/src/units.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#[derive(Clone, Copy, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Cycles<T>(pub T);

#[derive(Clone, Copy, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Radians<T>(pub T);

impl From<Cycles<f64>> for Radians<f64> {
fn from(cycles: Cycles<f64>) -> Self {
Radians(cycles.0 * 2.0 * std::f64::consts::PI)
}
}

impl From<Radians<f64>> for Cycles<f64> {
fn from(radians: Radians<f64>) -> Self {
Cycles(radians.0 / (2.0 * std::f64::consts::PI))
}
}
3 changes: 3 additions & 0 deletions quil-rs/src/waveform/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub(crate) mod templates;

pub use templates::*;
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
source: quil-rs/src/waveform/templates.rs
expression: neat_iq_values
---
+1.00000e0, +0.00000e0
+9.72655e-1, +8.58409e-3
+8.95025e-1, +1.57980e-2
+7.79165e-1, +2.06294e-2
+6.41713e-1, +2.26536e-2
+5.00000e-1, +2.20636e-2
+3.68567e-1, +1.95166e-2
+2.57028e-1, +1.58787e-2
+1.69576e-1, +1.19726e-2
+1.05843e-1, +8.40700e-3
+6.25000e-2, +5.51589e-3
+3.49152e-2, +3.38956e-3
+1.84530e-2, +1.95427e-3
+9.22651e-3, +1.05856e-3
+4.36440e-3, +5.39248e-4
+1.95313e-3, +2.58557e-4
+8.26900e-4, +1.16764e-4
+3.31202e-4, +4.96910e-5
+1.25502e-4, +1.99370e-5
+4.49911e-5, +7.54425e-6
+1.52588e-5, +2.69331e-6
+4.89588e-6, +9.07373e-7
+1.48614e-6, +2.88548e-7
+4.26781e-7, +8.66301e-8
+1.15950e-7, +2.45593e-8
+2.98023e-8, +6.57545e-9
+7.24684e-9, +1.66287e-9
+1.66711e-9, +3.97251e-10
+3.62827e-10, +8.96588e-11
+7.47052e-11, +1.91199e-11
+1.45519e-11, +3.85280e-12
+2.68168e-12, +7.33676e-13
+4.67532e-13, +1.32037e-13
+7.71140e-14, +2.24586e-14
+1.20330e-14, +3.61067e-15
+1.77636e-15, +5.48699e-16
+2.48088e-16, +7.88212e-17
+3.27791e-17, +1.07037e-17
+4.09739e-18, +1.37413e-18
+4.84546e-19, +1.66777e-19
+5.42101e-20, +1.91371e-20
+5.73777e-21, +2.07617e-21
+5.74544e-22, +2.12965e-22
+5.44279e-23, +2.06550e-23
+4.87795e-24, +1.89420e-24
+4.13590e-25, +1.64255e-25
+3.31758e-26, +1.34684e-26
+2.51762e-27, +1.04429e-27
+1.80749e-28, +7.65689e-29
+1.22766e-29, +5.30898e-30
+7.88861e-31, +3.48102e-31
+4.79556e-32, +2.15846e-32
+2.75801e-33, +1.26571e-33
+1.50062e-34, +7.01910e-35
+7.72434e-36, +3.68121e-36
+3.76158e-37, +1.82587e-37
+1.73300e-38, +8.56487e-39
+7.55339e-40, +3.79973e-40
+3.11461e-41, +1.59429e-41
+1.21502e-42, +6.32661e-43
+4.48416e-44, +2.37447e-44
+1.56565e-45, +8.42871e-46
+5.17164e-47, +2.82980e-47
+1.61614e-48, +8.98574e-49
+4.77799e-50, +2.69874e-50
+1.33638e-51, +7.66619e-52
+3.53617e-53, +2.05974e-53
+8.85226e-55, +5.23437e-55
+2.09649e-56, +1.25816e-56
+4.69729e-58, +2.86044e-58
+9.95682e-60, +6.15112e-60
+1.99669e-61, +1.25114e-61
+3.78809e-63, +2.40707e-63
+6.79902e-65, +4.38031e-65
+1.15449e-66, +7.53975e-67
+1.85460e-68, +1.22757e-68
+2.81858e-70, +1.89051e-70
+4.05253e-72, +2.75393e-72
+5.51239e-74, +3.79464e-74
+7.09368e-76, +4.94578e-76
+8.63617e-78, +6.09743e-78
+9.94690e-80, +7.11064e-80
+1.08386e-81, +7.84371e-82
+1.11731e-83, +8.18442e-84
+1.08967e-85, +8.07809e-86
+1.00538e-87, +7.54199e-88
+8.77579e-90, +6.66070e-90
+7.24700e-92, +5.56434e-92
+5.66172e-94, +4.39710e-94
+4.18462e-96, +3.28686e-96
+2.92605e-98, +2.32413e-98
+1.93564e-100, +1.55454e-100
+1.21139e-102, +9.83576e-103
+7.17237e-105, +5.88683e-105
+4.01752e-107, +3.33290e-107
+2.12898e-109, +1.78497e-109
+1.06734e-111, +9.04293e-112
+5.06233e-114, +4.33369e-114
+2.27152e-116, +1.96462e-116
+9.64274e-119, +8.42503e-119
Loading
Loading