Skip to content

Commit

Permalink
chore: Move the example programs into examples (#21)
Browse files Browse the repository at this point in the history
These where already presented as examples rather than binary packages.
  • Loading branch information
ABorgna authored Mar 29, 2024
1 parent 47fe445 commit 20723da
Show file tree
Hide file tree
Showing 19 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Run `just` to see all available commands.
## 🚀 Building the project

There is a miscellaneous collection of rust programs written using the library,
found in `src/bin`. To execute these programs, run:
found in `examples/`. To execute these programs, run:

```bash
cargo run --release --bin <program_name>
cargo run --release --example <program_name>
```

To build the python library, run:
Expand Down
2 changes: 1 addition & 1 deletion quizx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "quizx"
default-run = "hidden_shift_stabrank"
default-example = "hidden_shift_stabrank"
version = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion quizx/src/bin/big_simp.rs → quizx/examples/big_simp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::time::Instant;
// use quizx::tensor::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let c = Circuit::from_file("../circuits/large/hwb10.qasm")?.to_basic_gates();
let c = Circuit::from_file("circuits/large/hwb10.qasm")?.to_basic_gates();
println!("stats before: {}", c.stats());
let mut g: Graph = c.to_graph();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::time::Instant;
use std::{thread, time};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let f = "../circuits/small/tof_10.qasm";
let f = "circuits/small/tof_10.qasm";
let time = Instant::now();
println!("{}", f);
let c = Circuit::from_file(f)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ use std::fs;
use std::time::Instant;

fn main() -> Result<(), Box<dyn std::error::Error>> {
for e in fs::read_dir("../../circuits")? {
for e in fs::read_dir("circuits/small")? {
if let Some(f) = e?.path().to_str() {
let time = Instant::now();
println!("{}", f);
Circuit::from_file(f).unwrap_or_else(|_| panic!("circuit failed to parse: {}", f));
Circuit::from_file(f)
.unwrap_or_else(|e| panic!("circuit failed to parse: {}. {}", f, e));
println!("...done in {:.2?}", time.elapsed());
}
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use quizx::tensor::*;
use quizx::vec_graph::*;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let c = Circuit::from_file("../../../circuits/mod5_4.qasm")?;
let c = Circuit::from_file("circuits/small/mod5_4.qasm")?;
let c0 = c.to_basic_gates();
println!("Before:\n{}", c0.stats());
// let c = c.to_basic_gates();
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions quizx/src/bin/test_all.rs → quizx/examples/test_all.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ use std::fs;
use std::time::Instant;

fn main() -> Result<(), Box<dyn std::error::Error>> {
for e in fs::read_dir("../circuits/small")? {
for e in fs::read_dir("circuits/small")? {
if let Some(f) = e?.path().to_str() {
let time = Instant::now();
println!("{}", f);
let c =
Circuit::from_file(f).unwrap_or_else(|_| panic!("circuit failed to parse: {}", f));
let c = Circuit::from_file(f)
.unwrap_or_else(|e| panic!("circuit failed to parse: {}. {}", f, e));
println!("...done reading in {:.2?}", time.elapsed());
// if c.num_qubits() > 10 { continue; }

Expand Down
5 changes: 3 additions & 2 deletions quizx/src/bin/test_one.rs → quizx/examples/test_one.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ use std::time::Instant;
use std::{thread, time};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let f = "../circuits/large/gf2^64_mult.qasm";
let f = "circuits/large/gf2^64_mult.qasm";
let time = Instant::now();
println!("{}", f);
let c = Circuit::from_file(f).unwrap_or_else(|_| panic!("circuit failed to parse: {}", f));
let c =
Circuit::from_file(f).unwrap_or_else(|e| panic!("circuit failed to parse: {}. {}", f, e));
println!("...done reading in {:.2?}", time.elapsed());

// println!("Computing tensor");
Expand Down

0 comments on commit 20723da

Please sign in to comment.