-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
116 additions
and
26 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2025 The PECOS Developers | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
// in compliance with the License.You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software distributed under the License | ||
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
// or implied. See the License for the specific language governing permissions and limitations under | ||
// the License. | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
pub struct QubitId(pub usize); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use crate::qubit_id::QubitId; | ||
|
||
pub trait StabilizerCode { | ||
fn num_data_qubits(&self) -> usize; | ||
|
||
// Get a vector of the stabilizer generators used for the code. | ||
// Todo: Utilize PauliSet when available | ||
fn get_stabilizer_gens(&self) -> Vec<Vec<(usize, QubitId)>>; | ||
|
||
// Get the boundaries of the code | ||
// TODO: Consider adding identifiers to identify the boundary types | ||
fn get_boundaries(&self) -> Vec<Vec<QubitId>>; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod mwpm_2d; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
use pecos_core::QubitId; | ||
use petgraph::graph::NodeIndex; | ||
use petgraph::Graph; | ||
use std::collections::HashMap; | ||
|
||
// Recreate pecos/decoders/mwpm2d/{mwpm2d/py, precomputing.py} | ||
|
||
#[derive(Debug)] | ||
pub struct PrecomputedData { | ||
x_graph: Graph<(), f64>, | ||
z_graph: Graph<(), f64>, | ||
virtual_edges: HashMap<NodeIndex, VirtualEdgeData>, | ||
edge_to_data: HashMap<(NodeIndex, NodeIndex), QubitId>, | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct VirtualEdgeData { | ||
pub virtual_node: NodeIndex, | ||
pub weight: f64, | ||
pub syndrome_path: Vec<NodeIndex>, | ||
pub data_path: Vec<QubitId>, | ||
} | ||
|
||
struct Syndrome {} | ||
struct Recovery {} | ||
struct SurfaceCode {} | ||
|
||
// #[derive(Debug)] | ||
pub struct MWPM2DDecoder { | ||
precomputed: PrecomputedData, | ||
cached_recoveries: HashMap<Vec<Syndrome>, Recovery>, | ||
} | ||
|
||
impl MWPM2DDecoder { | ||
pub fn new(code: &SurfaceCode) -> Self { | ||
let precomputed = Self::precompute(code); | ||
Self { | ||
precomputed, | ||
cached_recoveries: HashMap::new(), | ||
} | ||
} | ||
|
||
fn precompute(code: &SurfaceCode) -> PrecomputedData { | ||
// Build distance graphs and lookup tables | ||
// Similar to precomputing.py | ||
PrecomputedData { | ||
x_graph: Graph::new(), | ||
z_graph: Graph::new(), | ||
virtual_edges: HashMap::new(), | ||
edge_to_data: HashMap::new(), | ||
} | ||
} | ||
|
||
pub fn decode(&mut self, syndromes: &[Syndrome]) -> Recovery { | ||
// 1. Check cache | ||
// 2. Build matching graph | ||
// 3. Add virtual nodes | ||
// 4. Find maximum weight perfect matching | ||
// 5. Convert matching to recovery operations | ||
Recovery {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ | |
// the License. | ||
|
||
// pecos-qec stub. Left intentionally blank for now. | ||
|
||
mod decoders; |