Skip to content

Commit

Permalink
Merge branch 'main' into linux-arm-tier1
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish authored Feb 22, 2025
2 parents b19817f + e404832 commit c91e679
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 76 deletions.
63 changes: 20 additions & 43 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ hashbrown.version = "0.15.2"
num-bigint = "0.4"
num-complex = "0.4"
nalgebra = "0.33"
ndarray = "0.15"
numpy = "0.23"
smallvec = "1.13"
ndarray = "0.16"
smallvec = "1.14"
thiserror = "2.0"
rustworkx-core = "0.16"
approx = "0.5"
Expand Down
6 changes: 3 additions & 3 deletions crates/accelerate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ faer = "0.19.4"
itertools.workspace = true
qiskit-circuit.workspace = true
thiserror.workspace = true
ndarray_einsum_beta = "0.7"
ndarray-einsum = "0.8.0"
once_cell = "1.20.3"
rustiq-core = "0.0.10"
bytemuck.workspace = true
Expand All @@ -43,7 +43,7 @@ features = ["hashbrown", "indexmap", "num-complex", "num-bigint", "smallvec"]

[dependencies.ndarray]
workspace = true
features = ["rayon", "approx-0_5"]
features = ["rayon", "approx"]

[dependencies.approx]
workspace = true
Expand All @@ -58,7 +58,7 @@ workspace = true
features = ["rayon"]

[dependencies.faer-ext]
version = "0.2.0"
version = "0.3.0"
features = ["ndarray"]

[dependencies.pulp]
Expand Down
6 changes: 3 additions & 3 deletions crates/accelerate/src/sparse_pauli_op.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ mod tests {
#[test]
fn decompose_empty_operator_fails() {
assert!(matches!(
decompose_dense_inner(aview2::<Complex64, [_; 0]>(&[]), 0.0),
decompose_dense_inner(aview2::<Complex64, 0>(&[]), 0.0),
Err(DecomposeError::BadShape(_)),
));
}
Expand Down Expand Up @@ -1408,7 +1408,7 @@ mod tests {
z_like,
};
let arr = Array1::from_vec(to_matrix_dense_inner(&paulis, false))
.into_shape((2, 2))
.into_shape_with_order((2, 2))
.unwrap();
let expected: DecomposeMinimal = paulis.into();
let actual: DecomposeMinimal = decompose_dense_inner(arr.view(), 0.0).unwrap().into();
Expand Down Expand Up @@ -1443,7 +1443,7 @@ mod tests {
z_like,
};
let arr = Array1::from_vec(to_matrix_dense_inner(&paulis, false))
.into_shape((8, 8))
.into_shape_with_order((8, 8))
.unwrap();
let expected: DecomposeMinimal = paulis.into();
let actual: DecomposeMinimal = decompose_dense_inner(arr.view(), 0.0).unwrap().into();
Expand Down
6 changes: 3 additions & 3 deletions crates/accelerate/src/unitary_compose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// that they have been altered from the originals.

use ndarray::{Array, Array2, ArrayView, ArrayView2, IxDyn};
use ndarray_einsum_beta::*;
use ndarray_einsum::*;
use num_complex::{Complex, Complex64, ComplexFloat};
use num_traits::Zero;
use qiskit_circuit::Qubit;
Expand Down Expand Up @@ -63,7 +63,7 @@ pub fn compose(

let res = _einsum_matmul(&tensor, &mat, &indices, shift, right_mul)?
.as_standard_layout()
.into_shape((num_rows, num_rows))
.into_shape_with_order((num_rows, num_rows))
.unwrap()
.into_dimensionality::<ndarray::Ix2>()
.unwrap()
Expand All @@ -76,7 +76,7 @@ fn per_qubit_shaped<'a>(array: &ArrayView2<'a, Complex<f64>>) -> ArrayView<'a, C
let overall_shape = (0..array.shape()[0].ilog2() as usize)
.flat_map(|_| [2, 2])
.collect::<Vec<usize>>();
array.into_shape(overall_shape).unwrap()
array.into_shape_with_order(overall_shape).unwrap()
}

// Determine einsum strings for perform a matrix multiplication on the input matrices
Expand Down
32 changes: 10 additions & 22 deletions crates/circuit/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2648,17 +2648,11 @@ impl Operation for PyInstruction {
fn definition(&self, _params: &[Param]) -> Option<CircuitData> {
Python::with_gil(|py| -> Option<CircuitData> {
match self.instruction.getattr(py, intern!(py, "definition")) {
Ok(definition) => {
let res: Option<PyObject> = definition.call0(py).ok()?.extract(py).ok();
match res {
Some(x) => {
let out: CircuitData =
x.getattr(py, intern!(py, "data")).ok()?.extract(py).ok()?;
Some(out)
}
None => None,
}
}
Ok(definition) => definition
.getattr(py, intern!(py, "_data"))
.ok()?
.extract::<CircuitData>(py)
.ok(),
Err(_) => None,
}
})
Expand Down Expand Up @@ -2731,17 +2725,11 @@ impl Operation for PyGate {
fn definition(&self, _params: &[Param]) -> Option<CircuitData> {
Python::with_gil(|py| -> Option<CircuitData> {
match self.gate.getattr(py, intern!(py, "definition")) {
Ok(definition) => {
let res: Option<PyObject> = definition.call0(py).ok()?.extract(py).ok();
match res {
Some(x) => {
let out: CircuitData =
x.getattr(py, intern!(py, "data")).ok()?.extract(py).ok()?;
Some(out)
}
None => None,
}
}
Ok(definition) => definition
.getattr(py, intern!(py, "_data"))
.ok()?
.extract::<CircuitData>(py)
.ok(),
Err(_) => None,
}
})
Expand Down

0 comments on commit c91e679

Please sign in to comment.