Skip to content

Commit

Permalink
Update c64 type, make builder fns public
Browse files Browse the repository at this point in the history
  • Loading branch information
Haadi-Khan committed Aug 25, 2024
1 parent a594d99 commit c7e0d3e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/gates/singleton.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use nalgebra::base::DMatrix;
use numpy::Complex64 as c64;
use crate::c64;

use crate::operations::{Gate, TimeUnit};

Expand Down
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use nalgebra::Complex;

pub mod circuit_instruction;
pub mod operations;
pub mod bit;
pub mod gates;
pub mod quantum_circuit;
pub mod quantum_circuit;

pub type c64 = Complex<f64>;
16 changes: 8 additions & 8 deletions src/operations.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use nalgebra::base::DMatrix;
use numpy::Complex64 as c64;
use std::fmt::Debug;
use crate::c64;

pub type TimeDependentFn = fn(f64) -> c64;

Expand Down Expand Up @@ -138,7 +138,7 @@ impl Delay {
}

impl Operation {
pub fn id(&self) -> i64 {
pub fn id(&self) -> u8 {
0
}
}
Expand All @@ -155,32 +155,32 @@ impl GateBuilder {
}
}

fn name(mut self, name: String) -> Self {
pub fn name(mut self, name: String) -> Self {
self.name = Some(name);
self
}

fn params(mut self, params: Vec<f64>) -> Self {
pub fn params(mut self, params: Vec<f64>) -> Self {
self.params = Some(params);
self
}

fn duration(mut self, duration: f64) -> Self {
pub fn duration(mut self, duration: f64) -> Self {
self.duration = Some(duration);
self
}

fn unit(mut self, unit: TimeUnit) -> Self {
pub fn unit(mut self, unit: TimeUnit) -> Self {
self.unit = Some(unit);
self
}

fn matrix(mut self, matrix: DMatrix<c64>) -> Self {
pub fn matrix(mut self, matrix: DMatrix<c64>) -> Self {
self.matrix = Some(matrix);
self
}

fn hamiltonian(mut self, hamiltonian: Hamiltonian) -> Self {
pub fn hamiltonian(mut self, hamiltonian: Hamiltonian) -> Self {
self.hamiltonian = Some(hamiltonian);
self
}
Expand Down
2 changes: 1 addition & 1 deletion src/quantum_circuit/parser.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use nalgebra::base::DMatrix;
use numpy::Complex64 as c64;
use crate::c64;

/// TODO: Migrate to a standard parser library instead of a custom one (didn't realized these existed before lol)
use crate::{
Expand Down

0 comments on commit c7e0d3e

Please sign in to comment.