cpp-pd-code-simplify-interface 0.1.18__tar.gz → 0.1.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (12) hide show
  1. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/PKG-INFO +1 -1
  2. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/cpp_pd_code_simplify_interface/data/src/pdcode_simplify.cpp +29 -3
  3. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/pyproject.toml +1 -1
  4. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/README.md +0 -0
  5. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/build_backend/cpp_pd_code_simplify_interface_build_backend.py +0 -0
  6. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/cpp_pd_code_simplify_interface/__init__.py +0 -0
  7. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/cpp_pd_code_simplify_interface/__main__.py +0 -0
  8. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/cpp_pd_code_simplify_interface/_worker.py +0 -0
  9. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/cpp_pd_code_simplify_interface/data/include/pdcode_simplify/pdcode_simplify.hpp +0 -0
  10. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/cpp_pd_code_simplify_interface/data/src/native_interface.cpp +0 -0
  11. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/cpp_pd_code_simplify_interface/main.py +0 -0
  12. {cpp_pd_code_simplify_interface-0.1.18 → cpp_pd_code_simplify_interface-0.1.19}/cpp_pd_code_simplify_interface/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cpp-pd-code-simplify-interface
3
- Version: 0.1.18
3
+ Version: 0.1.19
4
4
  Summary: Python interface for cpp-pd-code-simplify with runtime C++ compilation.
5
5
  License-Expression: MIT
6
6
  Author: GGN_2015
@@ -1323,7 +1323,9 @@ bool do_check(
1323
1323
  const std::vector<Endpoint>& red_path,
1324
1324
  const std::vector<int>& green_path,
1325
1325
  Direction direction,
1326
- SimplificationResult& result) {
1326
+ SimplificationResult& result,
1327
+ const SimplifierOptions& options) {
1328
+ check_timeout(options);
1327
1329
  std::vector<int> green_left_cross;
1328
1330
  green_left_cross.reserve(green_path.size());
1329
1331
 
@@ -1378,14 +1380,24 @@ bool do_check(
1378
1380
 
1379
1381
  bool good_path = true;
1380
1382
  while (!to_check.empty() && good_path) {
1383
+ check_timeout(options);
1381
1384
  const int start_key = to_check.back();
1382
1385
  to_check.pop_back();
1383
1386
  queued.erase(start_key);
1384
1387
  Endpoint cross_strand = endpoint_from_key(start_key);
1388
+ std::unordered_set<long long> trace_seen;
1385
1389
 
1386
1390
  while (true) {
1391
+ check_timeout(options);
1387
1392
  const int cross_key = endpoint_key(cross_strand);
1388
1393
  const Level current_level = check_result.at(cross_key);
1394
+ const long long trace_key =
1395
+ (static_cast<long long>(cross_key) << 1) ^
1396
+ static_cast<int>(current_level);
1397
+ if (!trace_seen.insert(trace_key).second) {
1398
+ good_path = false;
1399
+ break;
1400
+ }
1389
1401
  const Endpoint opposite = diagram.opposite(cross_strand);
1390
1402
  const int opposite_key = endpoint_key(opposite);
1391
1403
  const auto opposite_result = check_result.find(opposite_key);
@@ -2345,7 +2357,14 @@ RedPathSearchOutcome search_single_red_path(
2345
2357
  if (green_path.size() >= red_path.size()) {
2346
2358
  continue;
2347
2359
  }
2348
- if (do_check(diagram, graph, red_path, green_path, Direction::Left, outcome.witness)) {
2360
+ if (do_check(
2361
+ diagram,
2362
+ graph,
2363
+ red_path,
2364
+ green_path,
2365
+ Direction::Left,
2366
+ outcome.witness,
2367
+ options)) {
2349
2368
  if (!options.require_applicable || witness_has_applicable_surgery(code, outcome.witness)) {
2350
2369
  outcome.found = true;
2351
2370
  outcome.completed = true;
@@ -2354,7 +2373,14 @@ RedPathSearchOutcome search_single_red_path(
2354
2373
  }
2355
2374
  clear_witness(outcome.witness);
2356
2375
  }
2357
- if (do_check(diagram, graph, red_path, green_path, Direction::Right, outcome.witness)) {
2376
+ if (do_check(
2377
+ diagram,
2378
+ graph,
2379
+ red_path,
2380
+ green_path,
2381
+ Direction::Right,
2382
+ outcome.witness,
2383
+ options)) {
2358
2384
  if (!options.require_applicable || witness_has_applicable_surgery(code, outcome.witness)) {
2359
2385
  outcome.found = true;
2360
2386
  outcome.completed = true;
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cpp-pd-code-simplify-interface"
3
- version = "0.1.18"
3
+ version = "0.1.19"
4
4
  description = "Python interface for cpp-pd-code-simplify with runtime C++ compilation."
5
5
  authors = [
6
6
  {name = "GGN_2015", email = "neko@jlulug.org"}