Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start development of v1.1 #4

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ cc_binary(
"-std=c++20",
"-fvisibility=hidden",
"-DNDEBUG",
"-DVERSION_INFO=0.0.dev0",
"-DCHROMOBIUS_VERSION_INFO=0.0.dev0",
],
includes = ["src/"],
linkshared = 1,
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ if ((${pybind11_FOUND} AND ${Python_FOUND}) OR "$ENV{CMAKE_FORCE_PYBIND_CHROMOBI
target_compile_options(chromobius_pybind PRIVATE -O3 -DNDEBUG)
target_link_libraries(chromobius_pybind PRIVATE libstim libpymatching)
target_link_options(chromobius_pybind PRIVATE -O3)
add_compile_definitions(CHROMOBIUS_VERSION_INFO=${CHROMOBIUS_VERSION_INFO})
else()
message("WARNING: Skipped chromobius_pybind target. `pybind11` not found. To fix, install pybind11. On debian based distributions, the package name is `pybind11-dev`")
endif()
62 changes: 24 additions & 38 deletions doc/getting_started.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def build_extension(self, ext):
ext.sourcedir,
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={pathlib.Path(self.get_ext_fullpath(ext.name)).parent.absolute()}",
f"-DPYTHON_EXECUTABLE={sys.executable}",
f"-DVERSION_INFO={__version__}",
f"-DCHROMOBIUS_VERSION_INFO={__version__}",
*osx_cmake_flags,
*[
env_arg_item
Expand All @@ -71,7 +71,7 @@ def build_extension(self, ext):
], cwd=build_temp, env=build_env)


__version__ = '1.0.dev0'
__version__ = '1.1.dev0'

with open("README.md", "r", encoding="utf-8") as f:
long_description = f.read()
Expand Down
2 changes: 1 addition & 1 deletion src/chromobius/decode/decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Decoder Decoder::from_dem(const stim::DetectorErrorModel &dem, DecoderConfigOpti
for (const auto &e : remnant_edges) {
result.atomic_errors.emplace(std::move(e));
}
if (!options.include_coords_in_mobius_dem || result.mobius_dem.count_detectors() < result.node_colors.size() * 2) {
if (result.mobius_dem.count_detectors() < result.node_colors.size() * 2) {
// Ensure the number of detectors in the mobius dem is exactly correct.
result.mobius_dem.append_detector_instruction(
{}, stim::DemTarget::relative_detector_id(result.node_colors.size() * 2 - 1));
Expand Down
1 change: 0 additions & 1 deletion src/chromobius/decode/decoder.test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ TEST(decoder, from_dem_d5_color_code_x_only) {
error(0.1) D10 D16 ^ D11 D17
error(0.1) D5 D7 ^ D4 D10 ^ D6 D11
error(0.1) D9 D17 ^ D12 D16 ^ D8 D13
detector D17
)DEM");
ASSERT_TRUE(decoder.mobius_dem.approx_equals(expected_mobius_dem, 1e-5));
}
Expand Down
2 changes: 1 addition & 1 deletion src/chromobius/pybind/chromobius.pybind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ struct CompiledDecoder {
};

PYBIND11_MODULE(chromobius, m) {
m.attr("__version__") = xstr_literal(VERSION_INFO);
m.attr("__version__") = xstr_literal(CHROMOBIUS_VERSION_INFO);
m.doc() = R"pbdoc(
chromobius: A fast implementation of the mobius color code decoder.
)pbdoc";
Expand Down
5 changes: 5 additions & 0 deletions src/chromobius/pybind/chromobius_pybind_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


def test_version():
assert '.' in chromobius.__version__
assert chromobius.__version__ is not None


Expand Down Expand Up @@ -74,3 +75,7 @@ def test_decoding():
assert np.array_equal(predictions, predictions2)
mistakes = np.count_nonzero(np.any(predictions != obs, axis=1))
assert mistakes < 100


def test_empty():
assert chromobius.compile_decoder_for_dem(stim.DetectorErrorModel()) is not None
Loading