Skip to content

Commit 22e6d23

Browse files
committed
Merge remote-tracking branch 'origin/dev' into feat/rsquest
2 parents 79b178b + eb271d4 commit 22e6d23

File tree

33 files changed

+5112
-1728
lines changed

33 files changed

+5112
-1728
lines changed

Cargo.lock

Lines changed: 344 additions & 265 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ ndarray = "0.16"
8686
anyhow = "1"
8787
cxx = "1"
8888
cxx-build = "1"
89-
reqwest = { version = "0.12", default-features = false, features = ["blocking", "native-tls"] }
89+
reqwest = { version = "0.12", default-features = false, features = ["blocking", "rustls-tls"] }
9090
tar = "0.4"
9191
flate2 = "1"
92+
bzip2 = "0.4"
9293
sha2 = "0.10"
9394
dirs = "6"
94-
petgraph = "0.6"
9595

9696
pecos-core = { version = "0.1.1", path = "crates/pecos-core" }
9797
pecos-qsim = { version = "0.1.1", path = "crates/pecos-qsim" }

crates/pecos-build-utils/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ sha2.workspace = true
1414
dirs.workspace = true
1515
tar.workspace = true
1616
flate2.workspace = true
17+
bzip2.workspace = true

crates/pecos-build-utils/src/dependencies.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ pub const CHROMOBIUS_SHA256: &str =
3636
pub const QUEST_COMMIT: &str = "v4.0.0";
3737
pub const QUEST_SHA256: &str = "e6a922a9dc1d6ee7c4d2591a277646dca2ce2fd90eecf36fd66970cb24bbfb67";
3838

39+
/// Qulacs library constants
40+
/// Used by Qulacs quantum simulator
41+
pub const QULACS_VERSION: &str = "0.6.12";
42+
pub const QULACS_SHA256: &str = "b9e5422e0bb2b07725b0c62f7827326b5a1486facb30cf68d12b4ef119c485e9";
43+
44+
/// Eigen library constants
45+
/// Used by Qulacs quantum simulator
46+
pub const EIGEN_VERSION: &str = "3.4.0";
47+
pub const EIGEN_SHA256: &str = "8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72";
48+
49+
/// Boost library constants
50+
/// Used by Qulacs quantum simulator (for property_tree and dynamic_bitset)
51+
pub const BOOST_VERSION: &str = "1.83.0";
52+
pub const BOOST_SHA256: &str = "6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e";
53+
3954
/// Helper functions to create DownloadInfo structs for each dependency
4055
use crate::DownloadInfo;
4156

@@ -96,3 +111,37 @@ pub fn quest_download_info() -> DownloadInfo {
96111
name: format!("quest-{}", QUEST_COMMIT),
97112
}
98113
}
114+
115+
/// Create DownloadInfo for Qulacs
116+
pub fn qulacs_download_info() -> DownloadInfo {
117+
DownloadInfo {
118+
url: format!("https://github.com/qulacs/qulacs/archive/v{QULACS_VERSION}.tar.gz"),
119+
sha256: QULACS_SHA256,
120+
name: format!("qulacs-{}", QULACS_VERSION),
121+
}
122+
}
123+
124+
/// Create DownloadInfo for Eigen
125+
pub fn eigen_download_info() -> DownloadInfo {
126+
DownloadInfo {
127+
url: format!(
128+
"https://gitlab.com/libeigen/eigen/-/archive/{}/eigen-{}.tar.gz",
129+
EIGEN_VERSION, EIGEN_VERSION
130+
),
131+
sha256: EIGEN_SHA256,
132+
name: format!("eigen-{}", EIGEN_VERSION),
133+
}
134+
}
135+
136+
/// Create DownloadInfo for Boost
137+
pub fn boost_download_info() -> DownloadInfo {
138+
let version_underscore = BOOST_VERSION.replace('.', "_");
139+
DownloadInfo {
140+
url: format!(
141+
"https://archives.boost.io/release/{}/source/boost_{}.tar.bz2",
142+
BOOST_VERSION, version_underscore
143+
),
144+
sha256: BOOST_SHA256,
145+
name: format!("boost-{}", BOOST_VERSION),
146+
}
147+
}

crates/pecos-build-utils/src/extract.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,30 @@ use crate::errors::{BuildError, Result};
44
use std::fs;
55
use std::path::{Path, PathBuf};
66

7-
/// Extract a tar.gz archive and emit rerun-if-changed for all extracted files
7+
/// Extract a tar.gz or tar.bz2 archive and emit rerun-if-changed for all extracted files
88
pub fn extract_archive(
99
data: &[u8],
1010
out_dir: &Path,
1111
expected_dir_name: Option<&str>,
1212
) -> Result<PathBuf> {
13-
use flate2::read::GzDecoder;
1413
use tar::Archive;
1514

16-
let tar = GzDecoder::new(data);
17-
let mut archive = Archive::new(tar);
15+
// Try to detect if this is gzip or bzip2 by checking magic bytes
16+
let mut archive = if data.len() >= 3 && data[0] == 0x1f && data[1] == 0x8b && data[2] == 0x08 {
17+
// gzip magic bytes
18+
use flate2::read::GzDecoder;
19+
let tar = GzDecoder::new(data);
20+
Archive::new(Box::new(tar) as Box<dyn std::io::Read>)
21+
} else if data.len() >= 3 && &data[0..3] == b"BZh" {
22+
// bzip2 magic bytes
23+
use bzip2::read::BzDecoder;
24+
let tar = BzDecoder::new(data);
25+
Archive::new(Box::new(tar) as Box<dyn std::io::Read>)
26+
} else {
27+
return Err(BuildError::Archive(
28+
"Unknown archive format - not gzip or bzip2".to_string(),
29+
));
30+
};
1831

1932
// Extract to temporary directory first
2033
let temp_dir = out_dir.join(format!("extract_temp_{}", std::process::id()));

crates/pecos-cppsparsesim/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ readme = "README.md"
1313

1414
[dependencies]
1515
cxx.workspace = true
16-
pecos-core.workspace = true
1716
pecos-qsim.workspace = true
18-
rand.workspace = true
19-
rand_chacha.workspace = true
2017

2118
[build-dependencies]
2219
cxx-build.workspace = true

crates/pecos-decoders/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ default = []
2020
ldpc = ["dep:pecos-ldpc-decoders"]
2121
all = ["ldpc"]
2222

23-
[dev-dependencies]
24-
ndarray.workspace = true
25-
2623
[lib]
2724
name = "pecos_decoders"
2825

crates/pecos-ldpc-decoders/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ cxx.workspace = true
2020
[build-dependencies]
2121
pecos-build-utils.workspace = true
2222
cxx-build.workspace = true
23-
cc.workspace = true
2423

2524
[dev-dependencies]
2625
rand.workspace = true

crates/pecos-qulacs/Cargo.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[package]
2+
name = "pecos-qulacs"
3+
version.workspace = true
4+
edition.workspace = true
5+
authors.workspace = true
6+
homepage.workspace = true
7+
repository.workspace = true
8+
license.workspace = true
9+
keywords.workspace = true
10+
categories.workspace = true
11+
description = "Qulacs quantum simulator bindings for PECOS"
12+
readme.workspace = true
13+
14+
[dependencies]
15+
pecos-core.workspace = true
16+
pecos-qsim.workspace = true
17+
num-complex.workspace = true
18+
rand.workspace = true
19+
rand_chacha.workspace = true
20+
cxx.workspace = true
21+
22+
23+
[dev-dependencies]
24+
rand.workspace = true
25+
26+
[build-dependencies]
27+
cxx-build.workspace = true
28+
pecos-build-utils.workspace = true
29+
cc = "1.0"
30+
31+
[lib]
32+
name = "pecos_qulacs"
33+
34+
[lints]
35+
workspace = true

0 commit comments

Comments
 (0)