Unverified Commit b9e13522 authored by dwuggh's avatar dwuggh
Browse files

add more logs

parent 62dd5f96
......@@ -19,12 +19,15 @@ fn get_weight(pd: f64, pm: f64) -> (f64, f64) {
let mut w1 = f64::ln(pd / (1. - pd));
let mut w2 = f64::ln(pm / (1. - pm));
if w1.is_infinite() {
w1 = 0.0;
w1 = 1000000.0;
w2 = 1.0;
} else if w2.is_infinite() {
w1 = 1.0;
w2 = 1000000.0;
} else {
let wsum = w1 + w2;
// w1 = 1.0 - w1 / wsum;
// w2 = 1.0 - w2 / wsum;
// // w1 = 1.0 - w1 / wsum;
// // w2 = 1.0 - w2 / wsum;
w1 = w1 / wsum;
w2 = w2 / wsum;
}
......@@ -81,12 +84,16 @@ pub fn runner2(xn: usize, zm: usize, measure_rounds: usize, measure_model: Measu
let error_model = ErrorModel::new(channel, Some(measure_model));
let mut model = SurfaceCodeModel::new(xn, zm, &error_model, SurfModelClass::Surf1);
model.perform_ecc_3d(measure_rounds, 0, w1, w2);
let (gx, gz) = model.perform_ecc_3d(measure_rounds, 0, w1, w2);
let result = match model.has_logical_error() {
Some(Stabilizer::X) => 0,
Some(Stabilizer::Z) => 1,
None => 1,
};
if result == 0 {
log::warn!("gx: {:?}", gx);
log::warn!("gz: {:?}", gz);
}
log::info!("result: {}", result);
result
......
......@@ -161,6 +161,7 @@ impl Geometry for GridGeometry {
}
}
}
log::debug!("1D ecc: {:?}", graph);
return graph;
}
......
......@@ -260,7 +260,16 @@ impl<'a> SurfaceCodeModel<'a> {
}
}
pub fn perform_ecc_3d(&mut self, round: usize, cutoff: usize, w1: f64, w2: f64) {
pub fn perform_ecc_3d(
&mut self,
round: usize,
cutoff: usize,
w1: f64,
w2: f64,
) -> (
Graph<i64, f64, Undirected, u32>,
Graph<i64, f64, Undirected, u32>,
) {
let mut mxs: Vec<Vec<bool>> = Vec::new();
let mut mzs: Vec<Vec<bool>> = Vec::new();
for i in 0..round - cutoff {
......@@ -310,6 +319,7 @@ impl<'a> SurfaceCodeModel<'a> {
let graph_z = self.gz.get_defect_graph_3d(&defect_z, round, w1, w2);
self.perform_ecc_3d_inner(&graph_x, Stabilizer::X, w1, w2, round);
self.perform_ecc_3d_inner(&graph_z, Stabilizer::Z, w1, w2, round);
return (graph_x, graph_z);
}
fn perform_ecc_3d_inner(
......@@ -346,15 +356,15 @@ impl<'a> SurfaceCodeModel<'a> {
} as f64;
if a < b {
let path = g.get_path_between_measures(d1, d2);
// log::debug!("{}: path to boundary of {}: {:?}", stabilizer, d1, path);
log::debug!("{}: path to boundary of {}: {:?}", stabilizer, d1, path);
self.state.flip_path(stabilizer, &path);
} else {
// log::debug!("pure measurement error of {}: {}", stabilizer, t1);
log::debug!("pure measurement error of {}: {}", stabilizer, t1);
}
}
} else {
let path = g.get_path_between_measures(d1, d2);
// log::debug!("{}: path between {} and {}: {:?}", stabilizer, d1, d2, path);
log::debug!("{}: path between {} and {}: {:?}", stabilizer, d1, d2, path);
self.state.flip_path(stabilizer, &path);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment