Skip to content

Commit eae4d08

Browse files
authored
Merge branch 'main' into move-to-gh
2 parents 55f5480 + 17648eb commit eae4d08

28 files changed

+739
-400
lines changed

.github/workflows/wheels-build.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
os:
9191
- ubuntu-latest
9292
# Used for the x86_64 builds.
93-
- macos-12
93+
- macos-13
9494
# Used for the ARM builds.
9595
- macos-14
9696
- windows-latest
@@ -121,6 +121,7 @@ jobs:
121121
cat >>"$GITHUB_ENV" <<EOF
122122
CIBW_BEFORE_BUILD=bash ./tools/build_pgo.sh $PGO_WORK_DIR $PGO_OUT_PATH
123123
CIBW_ENVIRONMENT=RUSTUP_TOOLCHAIN=stable RUSTFLAGS='-Cprofile-use=$PGO_OUT_PATH -Cllvm-args=-pgo-warn-missing-function'
124+
CIBW_ENVIRONMENT_MACOS=MACOSX_DEPLOYMENT_TARGET='10.12' RUSTUP_TOOLCHAIN=stable RUSTFLAGS='-Cprofile-use=$PGO_OUT_PATH -Cllvm-args=-pgo-warn-missing-function'
124125
CIBW_ENVIRONMENT_LINUX=RUSTUP_TOOLCHAIN=stable RUSTFLAGS='-Cprofile-use=$PGO_OUT_PATH -Cllvm-args=-pgo-warn-missing-function' PATH="\$PATH:\$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true"
125126
EOF
126127
env:

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@ lint:
3131
tools/verify_headers.py qiskit test tools
3232
tools/find_optional_imports.py
3333
tools/find_stray_release_notes.py
34+
tools/verify_images.py
3435

3536
# Only pylint on files that have changed from origin/main. Also parallelize (disables cyclic-import check)
3637
lint-incr:
3738
-git fetch -q https://github.com/Qiskit/qiskit-terra.git :lint_incr_latest
3839
tools/pylint_incr.py -j4 -rn -sn --paths :/qiskit/*.py :/test/*.py :/tools/*.py
3940
tools/verify_headers.py qiskit test tools
4041
tools/find_optional_imports.py
42+
tools/verify_images.py
4143

4244
ruff:
4345
ruff qiskit test tools setup.py

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ from qiskit.primitives import StatevectorSampler
7070
sampler = StatevectorSampler()
7171
job = sampler.run([qc_measured], shots=1000)
7272
result = job.result()
73-
print(f" > Counts: {result[0].meas.get_counts()}")
73+
print(f" > Counts: {result[0].data["meas"].get_counts()}")
7474
```
7575
Running this will give an outcome similar to `{'000': 497, '111': 503}` which is `000` 50% of the time and `111` 50% of the time up to statistical fluctuations.
7676
To illustrate the power of Estimator, we now use the quantum information toolbox to create the operator $XXY+XYX+YXX-YYY$ and pass it to the `run()` function, along with our quantum circuit. Note the Estimator requires a circuit _**without**_ measurement, so we use the `qc_example` circuit we created earlier.

crates/accelerate/src/twirling.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn generate_twirled_circuit(
267267
custom_gate_map: Option<&CustomGateTwirlingMap>,
268268
optimizer_target: Option<&Target>,
269269
) -> PyResult<CircuitData> {
270-
let mut out_circ = CircuitData::clone_empty_like(circ, None);
270+
let mut out_circ = CircuitData::clone_empty_like(py, circ, None)?;
271271

272272
for inst in circ.data() {
273273
if let Some(custom_gate_map) = custom_gate_map {

crates/circuit/src/circuit_data.rs

+19-6
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,7 @@ impl CircuitData {
930930
instruction_iter.size_hint().0,
931931
global_phase,
932932
)?;
933+
933934
for item in instruction_iter {
934935
let (operation, params, qargs, cargs) = item?;
935936
let qubits = res.qargs_interner.insert_owned(qargs);
@@ -996,9 +997,13 @@ impl CircuitData {
996997
qubits,
997998
clbits,
998999
param_table: ParameterTable::new(),
999-
global_phase,
1000+
global_phase: Param::Float(0.0),
10001001
};
10011002

1003+
// use the global phase setter to ensure parameters are registered
1004+
// in the parameter table
1005+
res.set_global_phase(py, global_phase)?;
1006+
10021007
for inst in instruction_iter {
10031008
res.data.push(inst?);
10041009
res.track_instruction_parameters(py, res.data.len() - 1)?;
@@ -1040,6 +1045,7 @@ impl CircuitData {
10401045
instruction_iter.size_hint().0,
10411046
global_phase,
10421047
)?;
1048+
10431049
let no_clbit_index = res.cargs_interner.get_default();
10441050
for (operation, params, qargs) in instruction_iter {
10451051
let qubits = res.qargs_interner.insert(&qargs);
@@ -1073,8 +1079,13 @@ impl CircuitData {
10731079
qubits: BitData::new(py, "qubits".to_string()),
10741080
clbits: BitData::new(py, "clbits".to_string()),
10751081
param_table: ParameterTable::new(),
1076-
global_phase,
1082+
global_phase: Param::Float(0.0),
10771083
};
1084+
1085+
// use the global phase setter to ensure parameters are registered
1086+
// in the parameter table
1087+
res.set_global_phase(py, global_phase)?;
1088+
10781089
if num_qubits > 0 {
10791090
let qubit_cls = QUBIT.get_bound(py);
10801091
for _i in 0..num_qubits {
@@ -1528,16 +1539,18 @@ impl CircuitData {
15281539
/// * capacity - The capacity for instructions to use in the output `CircuitData`
15291540
/// If `None` the length of `other` will be used, if `Some` the integer
15301541
/// value will be used as the capacity.
1531-
pub fn clone_empty_like(other: &Self, capacity: Option<usize>) -> Self {
1532-
CircuitData {
1542+
pub fn clone_empty_like(py: Python, other: &Self, capacity: Option<usize>) -> PyResult<Self> {
1543+
let mut empty = CircuitData {
15331544
data: Vec::with_capacity(capacity.unwrap_or(other.data.len())),
15341545
qargs_interner: other.qargs_interner.clone(),
15351546
cargs_interner: other.cargs_interner.clone(),
15361547
qubits: other.qubits.clone(),
15371548
clbits: other.clbits.clone(),
15381549
param_table: ParameterTable::new(),
1539-
global_phase: other.global_phase.clone(),
1540-
}
1550+
global_phase: Param::Float(0.0),
1551+
};
1552+
empty.set_global_phase(py, other.global_phase.clone())?;
1553+
Ok(empty)
15411554
}
15421555

15431556
/// Append a PackedInstruction to the circuit data.

crates/circuit/src/dag_circuit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ impl DAGCircuit {
414414
py,
415415
concat!(
416416
"The property ``qiskit.dagcircuit.dagcircuit.DAGCircuit.duration`` is ",
417-
"deprecated as of qiskit 1.3.0. It will be removed in Qiskit 2.0.0.",
417+
"deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 2.0.0.",
418418
)
419419
),
420420
py.get_type_bound::<PyDeprecationWarning>(),
@@ -433,7 +433,7 @@ impl DAGCircuit {
433433
py,
434434
concat!(
435435
"The property ``qiskit.dagcircuit.dagcircuit.DAGCircuit.unit`` is ",
436-
"deprecated as of qiskit 1.3.0. It will be removed in Qiskit 2.0.0.",
436+
"deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 2.0.0.",
437437
)
438438
),
439439
py.get_type_bound::<PyDeprecationWarning>(),
@@ -7039,7 +7039,7 @@ fn emit_pulse_dependency_deprecation(py: Python, msg: &str) {
70397039
PyString::new_bound(
70407040
py,
70417041
&format!(
7042-
"The {} is deprecated as of qiskit 1.3.0. It will be removed in Qiskit 2.0.0. \
7042+
"The {} is deprecated as of Qiskit 1.3.0. It will be removed in Qiskit 2.0.0. \
70437043
The entire Qiskit Pulse package is being deprecated \
70447044
and this is a dependency on the package.",
70457045
msg

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ environment = 'PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI="true"
184184
repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel} && pipx run abi3audit --strict --report {wheel}"
185185

186186
[tool.cibuildwheel.macos]
187-
environment = "MACOSX_DEPLOYMENT_TARGET=10.12"
188187
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} && pipx run abi3audit --strict --report {wheel}"
189188

190189
[tool.cibuildwheel.windows]

0 commit comments

Comments
 (0)