Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dwuggh
surfcode-rs
Commits
b9e13522
Unverified
Commit
b9e13522
authored
Jul 13, 2021
by
dwuggh
Browse files
add more logs
parent
62dd5f96
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/controller.rs
View file @
b9e13522
...
...
@@ -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
=
100000
0.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
...
...
src/model/geometry/grid_geometry.rs
View file @
b9e13522
...
...
@@ -161,6 +161,7 @@ impl Geometry for GridGeometry {
}
}
}
log
::
debug!
(
"1D ecc: {:?}"
,
graph
);
return
graph
;
}
...
...
src/model/model.rs
View file @
b9e13522
...
...
@@ -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
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment