11#pragma once
22
33#include < vector>
4+ #include " WeightField.h"
5+ #include " UniformWeightField.h"
46#include " core/BinaryMatrix.h"
57#include " surface/BlossomMWPM.h"
68#include " surface/ISurfaceDecoder.h"
@@ -23,11 +25,16 @@ class MWPMDecoder : public ISurfaceDecoder {
2325 };
2426
2527 explicit MWPMDecoder (const SurfaceCode& code);
28+ MWPMDecoder (const SurfaceCode& code, const WeightField* weight_field, double weight_scale = 1000.0 );
2629 std::vector<int > decode (const SurfaceSyndrome& syn) override ;
2730
2831private:
2932 const SurfaceCode& code_;
3033 int d_ = 0 ;
34+ UniformWeightField uniform_weight_field_;
35+ const WeightField* weight_field_ = nullptr ;
36+ bool weighted_mode_ = false ;
37+ double weight_scale_ = 1000.0 ;
3138
3239 int hIndex (int x, int y) const ;
3340 int vIndex (int x, int y) const ;
@@ -37,6 +44,8 @@ class MWPMDecoder : public ISurfaceDecoder {
3744 std::vector<Defect> defectsFromPlaquetteSyndrome (const std::vector<int >& sz) const ;
3845 std::vector<Defect> defectsFromStarSyndrome (const std::vector<int >& sx) const ;
3946 int manhattan (const Defect& a, const Defect& b) const ;
47+ int weightedCost (const Defect& a, const Defect& b, bool plaquette_mode) const ;
48+ int weightedBoundaryCost (const Defect& d, bool plaquette_mode) const ;
4049 int DistToBoundaryZ (LatticeCoord zdef, int d) const ;
4150 int DistToBoundaryX (LatticeCoord xdef, int d) const ;
4251 int boundaryDistance (const Defect& d, bool plaquette_mode) const ;
0 commit comments