Skip to content

Commit

Permalink
Do renaming and cleaning/fixing of previously added files
Browse files Browse the repository at this point in the history
  • Loading branch information
jlapeyre committed Sep 9, 2024
1 parent 1ba5e3a commit ac6706f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
22 changes: 11 additions & 11 deletions crates/accelerate/src/gates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@
// copyright notice, and modified files need to carry a notice indicating
// that they have been altered from the originals.

use num_complex::{Complex64, ComplexFloat};
//use num_complex::{Complex64, ComplexFloat};
use num_complex::Complex64;
use ndarray::prelude::*;
// For Complex64::zero()
use num_traits::Zero;
// use num_traits::Zero;
use qiskit_circuit::util::{c64, C_ZERO};

pub(crate) fn rz_matrix(theta: f64) -> Array2<Complex64> {
let ilam2 = Complex64::new(0., 0.5 * theta);
array![
[(-ilam2).exp(), Complex64::new(0., 0.)],
[Complex64::new(0., 0.), ilam2.exp()]
]
let ilam2 = c64(0., 0.5 * theta);
array![[(-ilam2).exp(), C_ZERO], [C_ZERO, ilam2.exp()]]
}

pub(crate) fn rxx_matrix(theta: f64) -> Array2<Complex64> {
let theta2 = theta / 2.0;
let cos = Complex64::new(theta2.cos(), 0.0);
let isin = Complex64::new(0.0, theta2.sin());
let cz = Complex64::zero();
// let cos = c64::new(theta2.cos(), 0.0);
let cos = c64(theta2.cos(), 0.0);
let isin = c64(0.0, theta2.sin());
let cz = C_ZERO;
array![
[cos, cz, cz, -isin],
[cz, cos, -isin, cz],
Expand All @@ -40,7 +40,7 @@ pub(crate) fn ryy_matrix(theta: f64) -> Array2<Complex64> {
let theta2 = theta / 2.0;
let cos = Complex64::new(theta2.cos(), 0.0);
let isin = Complex64::new(0.0, theta2.sin());
let cz = Complex64::zero();
let cz = C_ZERO;
array![
[cos, cz, cz, isin],
[cz, cos, -isin, cz],
Expand Down
2 changes: 2 additions & 0 deletions crates/accelerate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub mod two_qubit_decompose;
pub mod uc_gate;
pub mod utils;
pub mod vf2_layout;
mod gates;
mod xx_decompose;

mod rayon_ext;
#[cfg(test)]
Expand Down
9 changes: 5 additions & 4 deletions crates/accelerate/src/two_qubit_decompose.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ use crate::euler_one_qubit_decomposer::{
};
use crate::utils;
use crate::QiskitError;
use crate::gates::{rz_matrix};

use rand::prelude::*;
use rand_distr::StandardNormal;
Expand Down Expand Up @@ -296,10 +297,10 @@ fn ry_matrix(theta: f64) -> Array2<Complex64> {
array![[cos, -sin], [sin, cos]]
}

fn rz_matrix(theta: f64) -> Array2<Complex64> {
let ilam2 = c64(0., 0.5 * theta);
array![[(-ilam2).exp(), C_ZERO], [C_ZERO, ilam2.exp()]]
}
// fn rz_matrix(theta: f64) -> Array2<Complex64> {
// let ilam2 = c64(0., 0.5 * theta);
// array![[(-ilam2).exp(), C_ZERO], [C_ZERO, ilam2.exp()]]
// }

fn compute_unitary(sequence: &TwoQubitSequenceVec, global_phase: f64) -> Array2<Complex64> {
let identity = aview2(&ONE_QUBIT_IDENTITY);
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[toolchain]
# Keep in sync with Cargo.toml's `rust-version`.
channel = "1.70"
# channel = "1.70"
components = [
"cargo",
"clippy",
Expand Down

0 comments on commit ac6706f

Please sign in to comment.