Skip to content

Commit

Permalink
Merge pull request #293 from rigetti/variable-qubit
Browse files Browse the repository at this point in the history
fix: no percent symbol in variable qubit outputs
  • Loading branch information
genos authored Oct 10, 2023
2 parents eb30581 + 9a82a2b commit 4807de0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
13 changes: 3 additions & 10 deletions quil-rs/src/instruction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,23 +219,16 @@ fn write_qubits(
Ok(())
}

/// Write qubits as a Quil parameter list, where each variable qubit must be prefixed with a `%`
/// and all are prefixed with ` `. Return an error if any is a qubit placeholder.
/// Write qubits as a Quil parameter list, where all are prefixed with ` `.
fn write_qubit_parameters(
f: &mut impl std::fmt::Write,
fall_back_to_debug: bool,
qubits: &[Qubit],
) -> ToQuilResult<()> {
for qubit in qubits.iter() {
match qubit {
Qubit::Variable(var) => write!(f, " %{var}")?,
other => {
write!(f, " ")?;
other.write(f, fall_back_to_debug)?;
}
}
write!(f, " ")?;
qubit.write(f, fall_back_to_debug)?;
}

Ok(())
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
source: quil-rs/src/program/calibration.rs
expression: calibrated_program.to_string()
expression: calibrated_program.to_quil_or_debug()
---
DEFCAL RX(%theta) %qubit:
DEFCAL RX(%theta) qubit:
PULSE 1 "xy" gaussian(duration: 1, fwhm: 2, t0: 3)
DEFCAL RX(%theta) 0:
PULSE 2 "xy" gaussian(duration: 1, fwhm: 2, t0: 3)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
source: quil-rs/src/program/calibration.rs
expression: calibrated_program.to_string()
expression: calibrated_program.to_quil_or_debug()
---
DEFCAL I %q:
DEFCAL I q:
DELAY q 4e-8
DELAY 0 4e-8

4 changes: 2 additions & 2 deletions ...-rs/src/program/snapshots/[email protected]
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
source: quil-rs/src/program/calibration.rs
expression: calibrated_program.to_string()
expression: calibrated_program.to_quil_or_debug()
---
DEFCAL RZ(%theta) %q:
DEFCAL RZ(%theta) q:
SHIFT-PHASE q "rf" -%theta
SHIFT-PHASE 0 "rf" -pi

0 comments on commit 4807de0

Please sign in to comment.