cpp-pd-code-simplify-interface 0.1.10__tar.gz → 0.1.11__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.
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/PKG-INFO +5 -4
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/README.md +4 -3
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/cpp_pd_code_simplify_interface/data/src/pdcode_simplify.cpp +12 -9
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/pyproject.toml +1 -1
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/build_backend/cpp_pd_code_simplify_interface_build_backend.py +0 -0
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/cpp_pd_code_simplify_interface/__init__.py +0 -0
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/cpp_pd_code_simplify_interface/__main__.py +0 -0
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/cpp_pd_code_simplify_interface/data/include/pdcode_simplify/pdcode_simplify.hpp +0 -0
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/cpp_pd_code_simplify_interface/data/src/native_interface.cpp +0 -0
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/cpp_pd_code_simplify_interface/main.py +0 -0
- {cpp_pd_code_simplify_interface-0.1.10 → cpp_pd_code_simplify_interface-0.1.11}/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.
|
|
3
|
+
Version: 0.1.11
|
|
4
4
|
Summary: Python interface for cpp-pd-code-simplify with runtime C++ compilation.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Author: GGN_2015
|
|
@@ -60,9 +60,10 @@ print(result["final_pd_code"])
|
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Returned `final_pd_code` strings are normalized for display: each crossing is
|
|
63
|
-
written from the under-incoming edge
|
|
64
|
-
components from `1
|
|
65
|
-
backend keeps its internal
|
|
63
|
+
written from the under-incoming edge, labels are renumbered along oriented
|
|
64
|
+
components from `1`, and crossing rows are sorted lexicographically. This is
|
|
65
|
+
applied only at the final JSON boundary; the C++ backend keeps its internal
|
|
66
|
+
numbering unchanged while simplifying.
|
|
66
67
|
|
|
67
68
|
The default `max_paths=-1` uses deterministic heuristic green-path sampling in
|
|
68
69
|
the C++ backend. Use `ban_heuristic=True` to request exhaustive green-path
|
|
@@ -40,9 +40,10 @@ print(result["final_pd_code"])
|
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
Returned `final_pd_code` strings are normalized for display: each crossing is
|
|
43
|
-
written from the under-incoming edge
|
|
44
|
-
components from `1
|
|
45
|
-
backend keeps its internal
|
|
43
|
+
written from the under-incoming edge, labels are renumbered along oriented
|
|
44
|
+
components from `1`, and crossing rows are sorted lexicographically. This is
|
|
45
|
+
applied only at the final JSON boundary; the C++ backend keeps its internal
|
|
46
|
+
numbering unchanged while simplifying.
|
|
46
47
|
|
|
47
48
|
The default `max_paths=-1` uses deterministic heuristic green-path sampling in
|
|
48
49
|
the C++ backend. Use `ban_heuristic=True` to request exhaustive green-path
|
|
@@ -510,8 +510,10 @@ std::vector<std::vector<int>> raw_faces_from_pd_code(const PDCode& code) {
|
|
|
510
510
|
struct Diagram {
|
|
511
511
|
PDCode code;
|
|
512
512
|
std::vector<CrossingState> crossings;
|
|
513
|
+
std::vector<int> rotations;
|
|
513
514
|
|
|
514
|
-
explicit Diagram(PDCode input)
|
|
515
|
+
explicit Diagram(PDCode input)
|
|
516
|
+
: code(std::move(input)), crossings(code.size()), rotations(code.size(), 0) {
|
|
515
517
|
build_adjacency();
|
|
516
518
|
auto starts = component_starts_from_pd();
|
|
517
519
|
orient_crossings(starts);
|
|
@@ -533,6 +535,10 @@ struct Diagram {
|
|
|
533
535
|
return Endpoint{endpoint.crossing, positive_mod(endpoint.strand + offset, 4)};
|
|
534
536
|
}
|
|
535
537
|
|
|
538
|
+
int label_at(int crossing, int strand) const {
|
|
539
|
+
return code.at(crossing).at(positive_mod(strand + rotations.at(crossing), 4));
|
|
540
|
+
}
|
|
541
|
+
|
|
536
542
|
std::vector<Endpoint> crossing_entries() const {
|
|
537
543
|
std::vector<Endpoint> entries;
|
|
538
544
|
entries.reserve(crossings.size() * 2);
|
|
@@ -715,6 +721,7 @@ private:
|
|
|
715
721
|
|
|
716
722
|
void rotate_crossing_180(int crossing) {
|
|
717
723
|
auto old_adjacent = crossings[crossing].adjacent;
|
|
724
|
+
rotations[crossing] = positive_mod(rotations[crossing] + 2, 4);
|
|
718
725
|
bool old_directions[4][4]{};
|
|
719
726
|
for (int a = 0; a < 4; ++a) {
|
|
720
727
|
for (int b = 0; b < 4; ++b) {
|
|
@@ -1878,14 +1885,9 @@ std::string format_final_pd_code(const PDCode& code) {
|
|
|
1878
1885
|
std::set<int> labels;
|
|
1879
1886
|
std::map<int, int> next_label;
|
|
1880
1887
|
|
|
1881
|
-
auto label_at = [&](int crossing, int strand) {
|
|
1882
|
-
const Endpoint other = diagram.crossings[crossing].adjacent[strand];
|
|
1883
|
-
return diagram.code[other.crossing][other.strand];
|
|
1884
|
-
};
|
|
1885
|
-
|
|
1886
1888
|
for (int crossing = 0; crossing < static_cast<int>(code.size()); ++crossing) {
|
|
1887
1889
|
for (int strand = 0; strand < 4; ++strand) {
|
|
1888
|
-
const int label = label_at(crossing, strand);
|
|
1890
|
+
const int label = diagram.label_at(crossing, strand);
|
|
1889
1891
|
oriented[crossing][strand] = label;
|
|
1890
1892
|
labels.insert(label);
|
|
1891
1893
|
}
|
|
@@ -1898,8 +1900,8 @@ std::string format_final_pd_code(const PDCode& code) {
|
|
|
1898
1900
|
if (!diagram.crossings[crossing].directions[tail][head]) {
|
|
1899
1901
|
continue;
|
|
1900
1902
|
}
|
|
1901
|
-
const int in_label = label_at(crossing, tail);
|
|
1902
|
-
const int out_label = label_at(crossing, head);
|
|
1903
|
+
const int in_label = diagram.label_at(crossing, tail);
|
|
1904
|
+
const int out_label = diagram.label_at(crossing, head);
|
|
1903
1905
|
const auto inserted = next_label.insert(std::make_pair(in_label, out_label));
|
|
1904
1906
|
if (!inserted.second && inserted.first->second != out_label) {
|
|
1905
1907
|
throw std::invalid_argument("Final PD component orientation is inconsistent");
|
|
@@ -1934,6 +1936,7 @@ std::string format_final_pd_code(const PDCode& code) {
|
|
|
1934
1936
|
label = relabel.at(label);
|
|
1935
1937
|
}
|
|
1936
1938
|
}
|
|
1939
|
+
std::sort(oriented.begin(), oriented.end());
|
|
1937
1940
|
return format_pd_code(oriented);
|
|
1938
1941
|
}
|
|
1939
1942
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|