Skip to content

Commit 5282fb0

Browse files
authored
Merge pull request #40 from qsharp-community/qdk-1.23-v2
updated to QDK 1.23
2 parents c92e8d2 + f36466e commit 5282fb0

3 files changed

Lines changed: 44 additions & 34 deletions

File tree

Cargo.lock

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ edition = "2024"
99
crate-type = ["lib", "cdylib", "staticlib"]
1010

1111
[dependencies]
12-
qsc = { git = "https://github.com/microsoft/qdk.git", branch = "main" }
13-
qsc_eval = { git = "https://github.com/microsoft/qdk.git", branch = "main" }
14-
qsc_circuit = { git = "https://github.com/microsoft/qdk.git", branch = "main" }
15-
resource_estimator = { git = "https://github.com/microsoft/qdk.git", branch = "main" }
12+
qsc = { git = "https://github.com/microsoft/qdk.git", tag = "v1.23.0" }
13+
qsc_eval = { git = "https://github.com/microsoft/qdk.git", tag = "v1.23.0" }
14+
qsc_circuit = { git = "https://github.com/microsoft/qdk.git", tag = "v1.23.0" }
15+
resource_estimator = { git = "https://github.com/microsoft/qdk.git", tag = "v1.23.0" }
1616
thiserror = "1.0"
1717
num-bigint = "0.4.5"
1818
num-complex = "0.4"

src/quantikz.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use qsc::{
22
LanguageFeatures, PackageType, SourceMap,
33
interpret::{CircuitEntryPoint, CircuitGenerationMethod, Interpreter}, target::Profile,
44
};
5-
use qsc_circuit::{Circuit, Operation, TracerConfig};
5+
use qsc_circuit::{Circuit, ComponentColumn, Operation, TracerConfig};
66
use std::collections::HashMap;
77

88
use crate::sim::QsError;
@@ -56,10 +56,20 @@ fn generate_quantikz_circuit(
5656

5757
pub fn circuit_to_quantikz(c: &Circuit) -> String {
5858
let (mut rows, register_to_row) = build_rows(c);
59-
let col_count = c.component_grid.len();
59+
60+
let grid = if c.component_grid.len() == 1
61+
&& c.component_grid[0].components.len() == 1
62+
&& !c.component_grid[0].components[0].children().is_empty()
63+
{
64+
c.component_grid[0].components[0].children()
65+
} else {
66+
&c.component_grid
67+
};
68+
69+
let col_count = grid.len();
6070
let mut table = initialize_table(rows.len(), col_count, &rows);
6171

62-
populate_table(c, &register_to_row, &mut table, &mut rows);
72+
populate_table(grid, &register_to_row, &mut table, &mut rows);
6373

6474
render_latex(&rows, &table)
6575
}
@@ -103,12 +113,12 @@ fn initialize_table(row_count: usize, col_count: usize, rows: &[Row]) -> Vec<Vec
103113
}
104114

105115
fn populate_table(
106-
c: &Circuit,
116+
grid: &[ComponentColumn],
107117
register_to_row: &RegisterMap,
108118
table: &mut [Vec<String>],
109119
rows: &mut [Row],
110120
) {
111-
for (col_index, col) in c.component_grid.iter().enumerate() {
121+
for (col_index, col) in grid.iter().enumerate() {
112122
let table_col = col_index;
113123
for op in &col.components {
114124
// For measurements, we want to draw on the qubit line, so we treat qubits as targets for visual placement

0 commit comments

Comments
 (0)