From 8afbc7e9ac1ebdf00479994203029c9a7ecb9989 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Mon, 2 Dec 2024 15:46:15 +0100 Subject: [PATCH 01/42] :snake: Added a `pyfiction.pyi` file with an example for setting up the Python typing interface --- bindings/mnt/pyfiction/pyfiction.pyi | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 bindings/mnt/pyfiction/pyfiction.pyi diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi new file mode 100644 index 000000000..a4e5eeb9d --- /dev/null +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -0,0 +1,50 @@ +from typing import overload + + +class offset_coordinate: + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, int_repr: int) -> None: ... + + @overload + def __init__(self, x: int, y: int, z: int) -> None: ... + + @overload + def __init__(self, c: offset_coordinate) -> None: ... + + @overload + def __init__(self, c: tuple[int, int, int]) -> None: ... + + x: int + y: int + z: int + + def __eq__(self, other: object) -> bool: ... + + def __ne__(self, other: object) -> bool: ... + + def __lt__(self, other: offset_coordinate) -> bool: ... + + def __gt__(self, other: offset_coordinate) -> bool: ... + + def __le__(self, other: offset_coordinate) -> bool: ... + + def __ge__(self, other: offset_coordinate) -> bool: ... + + def __repr__(self) -> str: ... + + def __hash__(self) -> int: ... + +# TODO for cube_coordinate and siqad_coordinate + +def offset_area(coord: offset_coordinate) -> int: ... +# def cube_area(coord: cube_coordinate) -> int: ... +# def siqad_area(coord: siqad_coordinate) -> int: ... + +def offset_volume(coord: offset_coordinate) -> int: ... +# def cube_volume(coord: cube_coordinate) -> int: ... +# def siqad_volume(coord: siqad_coordinate) -> int: ... + +# ... From 6b04f4deab3d5f451eb2e55f2e71f5a59d02b20e Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 18:20:39 +0100 Subject: [PATCH 02/42] :art: Replace `offset_area`, `cube_area`, and `siqad_area` with `area` for consistency. Analogously for `volume`. --- bindings/mnt/pyfiction/__init__.py | 16 ++++------------ .../include/pyfiction/layouts/coordinates.hpp | 12 ++++++------ .../pyfiction/test/layouts/test_coordinates.py | 13 ++++++++++++- docs/layouts/coordinates.rst | 10 ++-------- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/bindings/mnt/pyfiction/__init__.py b/bindings/mnt/pyfiction/__init__.py index a14d0d400..7b81f1829 100644 --- a/bindings/mnt/pyfiction/__init__.py +++ b/bindings/mnt/pyfiction/__init__.py @@ -285,12 +285,8 @@ offset_coordinate, cube_coordinate, siqad_coordinate, - offset_area, - cube_area, - siqad_area, - offset_volume, - cube_volume, - siqad_volume, + area, + volume, to_offset_coord, to_cube_coord, to_siqad_coord, @@ -667,12 +663,8 @@ "offset_coordinate", "cube_coordinate", "siqad_coordinate", - "offset_area", - "cube_area", - "siqad_area", - "offset_volume", - "cube_volume", - "siqad_volume", + "area", + "volume", "to_offset_coord", "to_cube_coord", "to_siqad_coord", diff --git a/bindings/mnt/pyfiction/include/pyfiction/layouts/coordinates.hpp b/bindings/mnt/pyfiction/include/pyfiction/layouts/coordinates.hpp index 360e9896b..fe49ee028 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/layouts/coordinates.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/layouts/coordinates.hpp @@ -208,13 +208,13 @@ inline void coordinate_utility(pybind11::module& m) { namespace py = pybind11; - m.def("offset_area", &fiction::area, py::arg("coord"), DOC(fiction_area)); - m.def("cube_area", &fiction::area, py::arg("coord"), DOC(fiction_area)); - m.def("siqad_area", &fiction::area, py::arg("coord"), DOC(fiction_area)); + m.def("area", &fiction::area, py::arg("coord"), DOC(fiction_area)); + m.def("area", &fiction::area, py::arg("coord"), DOC(fiction_area)); + m.def("area", &fiction::area, py::arg("coord"), DOC(fiction_area)); - m.def("offset_volume", &fiction::volume, py::arg("coord"), DOC(fiction_volume)); - m.def("cube_volume", &fiction::volume, py::arg("coord"), DOC(fiction_volume)); - m.def("siqad_volume", &fiction::volume, py::arg("coord"), DOC(fiction_volume)); + m.def("volume", &fiction::volume, py::arg("coord"), DOC(fiction_volume)); + m.def("volume", &fiction::volume, py::arg("coord"), DOC(fiction_volume)); + m.def("volume", &fiction::volume, py::arg("coord"), DOC(fiction_volume)); m.def("to_offset_coord", &fiction::siqad::to_fiction_coord, py::arg("coord"), DOC(fiction_siqad_to_fiction_coord)); diff --git a/bindings/mnt/pyfiction/test/layouts/test_coordinates.py b/bindings/mnt/pyfiction/test/layouts/test_coordinates.py index cd383e709..4acedc3ac 100644 --- a/bindings/mnt/pyfiction/test/layouts/test_coordinates.py +++ b/bindings/mnt/pyfiction/test/layouts/test_coordinates.py @@ -1,4 +1,4 @@ -from mnt.pyfiction import (offset_coordinate, cube_coordinate, siqad_coordinate) +from mnt.pyfiction import (offset_coordinate, cube_coordinate, siqad_coordinate, area, volume) import unittest @@ -32,6 +32,10 @@ def test_unsigned_offset_coordinates(self): self.assertEqual(offset_coordinate(3, 2, 1).__repr__(), "(3,2,1)") + self.assertEqual(area(offset_coordinate(3, 2)), 12) + self.assertEqual(area(offset_coordinate(3, 2, 1)), 12) + self.assertEqual(volume(offset_coordinate(3, 2, 1)), 24) + def test_signed_cube_coordinates(self): cube_coordinate((1, 0)) cube_coordinate((1, 0, 0)) @@ -60,6 +64,10 @@ def test_signed_cube_coordinates(self): self.assertEqual(cube_coordinate(3, 2, 1).__repr__(), "(3,2,1)") + self.assertEqual(area(cube_coordinate(3, 2)), 12) + self.assertEqual(area(cube_coordinate(3, 2, 1)), 12) + self.assertEqual(volume(cube_coordinate(3, 2, 1)), 24) + def test_signed_siqad_coordinates(self): siqad_coordinate((1, 0)) siqad_coordinate((1, 0, 0)) @@ -88,6 +96,9 @@ def test_signed_siqad_coordinates(self): self.assertEqual(siqad_coordinate(3, 2, 1).__repr__(), "(3,2,1)") + self.assertEqual(area(siqad_coordinate(3, 2, 1)), 24) + self.assertEqual(volume(siqad_coordinate(3, 2, 1)), 24) + if __name__ == '__main__': unittest.main() diff --git a/docs/layouts/coordinates.rst b/docs/layouts/coordinates.rst index 17330647f..722dba4dd 100644 --- a/docs/layouts/coordinates.rst +++ b/docs/layouts/coordinates.rst @@ -59,15 +59,9 @@ Utility functions .. doxygenfunction:: fiction::siqad::to_siqad_coord .. tab:: Python - .. autofunction:: mnt.pyfiction.offset_area - .. autofunction:: mnt.pyfiction.cube_area - .. autofunction:: mnt.pyfiction.siqad_area - - .. autofunction:: mnt.pyfiction.offset_volume - .. autofunction:: mnt.pyfiction.cube_volume - .. autofunction:: mnt.pyfiction.siqad_volume + .. autofunction:: mnt.pyfiction.area + .. autofunction:: mnt.pyfiction.volume .. autofunction:: mnt.pyfiction.to_offset_coord .. autofunction:: mnt.pyfiction.to_cube_coord - .. autofunction:: mnt.pyfiction.to_siqad_coord From 9458338d59446353457714b1f178b8c6ab7ad11a Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 18:27:56 +0100 Subject: [PATCH 03/42] :art: Fix duplicated `namespace py = pybind11;` --- .../include/pyfiction/algorithms/physical_design/exact.hpp | 1 - .../physical_design/graph_oriented_layout_design.hpp | 1 - .../pyfiction/algorithms/physical_design/orthogonal.hpp | 1 - .../algorithms/physical_design/post_layout_optimization.hpp | 1 - .../pyfiction/algorithms/physical_design/wiring_reduction.hpp | 1 - .../simulation/sidb/assess_physical_population_stability.hpp | 1 - .../algorithms/simulation/sidb/compute_operational_ratio.hpp | 2 -- .../pyfiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp | 1 - .../pyfiction/algorithms/simulation/sidb/detect_bdl_wires.hpp | 2 -- .../simulation/sidb/determine_physically_valid_parameters.hpp | 1 - .../simulation/sidb/displacement_robustness_domain.hpp | 2 -- .../algorithms/simulation/sidb/operational_domain.hpp | 1 - .../pyfiction/algorithms/simulation/sidb/quickexact.hpp | 1 - .../simulation/sidb/random_sidb_layout_generator.hpp | 1 - .../algorithms/simulation/sidb/sidb_simulation_parameters.hpp | 1 - .../algorithms/simulation/sidb/sidb_simulation_result.hpp | 1 - .../mnt/pyfiction/include/pyfiction/inout/write_qca_layout.hpp | 1 - .../mnt/pyfiction/include/pyfiction/inout/write_svg_layout.hpp | 1 - .../pyfiction/include/pyfiction/layouts/cartesian_layout.hpp | 1 - .../pyfiction/include/pyfiction/layouts/cell_level_layout.hpp | 1 - .../mnt/pyfiction/include/pyfiction/layouts/clocked_layout.hpp | 1 - .../mnt/pyfiction/include/pyfiction/layouts/coordinates.hpp | 3 --- .../pyfiction/include/pyfiction/layouts/gate_level_layout.hpp | 1 - .../pyfiction/include/pyfiction/layouts/hexagonal_layout.hpp | 1 - .../pyfiction/include/pyfiction/layouts/obstruction_layout.hpp | 1 - .../include/pyfiction/layouts/shifted_cartesian_layout.hpp | 1 - .../pyfiction/include/pyfiction/networks/logic_networks.hpp | 1 - .../pyfiction/technology/charge_distribution_surface.hpp | 1 - .../include/pyfiction/technology/sidb_charge_state.hpp | 1 - .../pyfiction/include/pyfiction/technology/sidb_lattice.hpp | 1 - 30 files changed, 35 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/exact.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/exact.hpp index 28ff8f24d..0f1061566 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/exact.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/exact.hpp @@ -26,7 +26,6 @@ namespace pyfiction inline void exact(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::enum_(m, "technology_constraints", DOC(fiction_technology_constraints)) .value("NONE", fiction::technology_constraints::NONE, DOC(fiction_technology_constraints_NONE)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/graph_oriented_layout_design.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/graph_oriented_layout_design.hpp index ceca6f703..3a7e4a50d 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/graph_oriented_layout_design.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/graph_oriented_layout_design.hpp @@ -25,7 +25,6 @@ namespace pyfiction inline void graph_oriented_layout_design(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::enum_( m, "gold_effort_mode", DOC(fiction_graph_oriented_layout_design_params_effort_mode)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/orthogonal.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/orthogonal.hpp index 4fac19f3c..da80a40a4 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/orthogonal.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/orthogonal.hpp @@ -24,7 +24,6 @@ namespace pyfiction inline void orthogonal(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, "orthogonal_params", DOC(fiction_orthogonal_physical_design_params)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/post_layout_optimization.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/post_layout_optimization.hpp index fb892f852..fe52c30c0 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/post_layout_optimization.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/post_layout_optimization.hpp @@ -21,7 +21,6 @@ namespace pyfiction inline void post_layout_optimization(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, "post_layout_optimization_params", DOC(fiction_post_layout_optimization_params)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/wiring_reduction.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/wiring_reduction.hpp index 3496a9184..fb2ab374e 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/wiring_reduction.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/wiring_reduction.hpp @@ -21,7 +21,6 @@ namespace pyfiction inline void wiring_reduction(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, "wiring_reduction_params", DOC(fiction_wiring_reduction_params)) .def(py::init<>()) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp index 811a80010..3fd4e5376 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/assess_physical_population_stability.hpp @@ -23,7 +23,6 @@ template void assess_physical_population_stability(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; m.def("assess_physical_population_stability", &fiction::assess_physical_population_stability, py::arg("lyt"), py::arg("params") = fiction::assess_physical_population_stability_params{}, diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/compute_operational_ratio.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/compute_operational_ratio.hpp index 7c32019e5..f5346149a 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/compute_operational_ratio.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/compute_operational_ratio.hpp @@ -24,7 +24,6 @@ template void compute_operational_ratio(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; m.def("compute_operational_ratio", &fiction::compute_operational_ratio, py::arg("lyt"), py::arg("spec"), py::arg("pp"), py::arg("params") = fiction::operational_domain_params{}, @@ -36,7 +35,6 @@ void compute_operational_ratio(pybind11::module& m) inline void compute_operational_ratio(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, "compute_operational_ratio_params", DOC(fiction_compute_operational_ratio_params)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp index 960cb0cda..a3ac4f350 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp @@ -38,7 +38,6 @@ void detect_bdl_pairs(pybind11::module& m) inline void detect_bdl_pairs(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_>(m, "bdl_pair", DOC(fiction_bdl_pair)) .def(py::init<>(), DOC(fiction_bdl_pair_bdl_pair)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_wires.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_wires.hpp index 89848091f..9ae561533 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_wires.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_wires.hpp @@ -24,7 +24,6 @@ template void detect_bdl_wires(pybind11::module& m, const std::string& lattice) { namespace py = pybind11; - namespace py = pybind11; using bdl_wire_t = fiction::bdl_wire; @@ -52,7 +51,6 @@ void detect_bdl_wires(pybind11::module& m, const std::string& lattice) inline void detect_bdl_wires(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; // Enum for wire selection options py::enum_(m, "bdl_wire_selection", DOC(fiction_bdl_wire_selection)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp index e06ac9a00..d2cace689 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp @@ -34,7 +34,6 @@ void determine_physically_valid_parameters(pybind11::module& m) inline void determine_physically_valid_parameters(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_>(m, "physically_valid_parameters_domain", DOC(fiction_operational_domain)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp index 5f220ca78..ed491e746 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp @@ -25,7 +25,6 @@ void determine_displacement_robustness_domain(pybind11::module& m, const std::st { namespace py = pybind11; - namespace py = pybind11; py::class_>( m, fmt::format("displacement_robustness_domain{}", lattice).c_str()) @@ -42,7 +41,6 @@ void determine_displacement_robustness_domain(pybind11::module& m, const std::st inline void determine_displacement_robustness_domain(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::enum_::dimer_displacement_policy>( m, "dimer_displacement_policy") diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/operational_domain.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/operational_domain.hpp index bcb416d19..90176770a 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/operational_domain.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/operational_domain.hpp @@ -50,7 +50,6 @@ void operational_domain(pybind11::module& m) inline void operational_domain(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, "parameter_point", DOC(fiction_parameter_point)) .def(py::init<>(), DOC(fiction_parameter_point_parameter_point)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/quickexact.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/quickexact.hpp index 25833c05c..f1a1b16cb 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/quickexact.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/quickexact.hpp @@ -35,7 +35,6 @@ inline void quickexact(pybind11::module& m) { // NOTE be careful with the order of the following calls! Python will resolve the first matching overload! namespace py = pybind11; - namespace py = pybind11; py::enum_::automatic_base_number_detection>( m, "automatic_base_number_detection", DOC(fiction_quickexact_params_automatic_base_number_detection)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/random_sidb_layout_generator.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/random_sidb_layout_generator.hpp index 1a330627a..154f58f7a 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/random_sidb_layout_generator.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/random_sidb_layout_generator.hpp @@ -41,7 +41,6 @@ void random_layout_generator(pybind11::module& m) inline void random_sidb_layout_generator(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::enum_::positive_charges>( m, "positive_charges", DOC(fiction_generate_random_sidb_layout_params_positive_charges)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp index 815b579e1..3e309b4d4 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/sidb_simulation_parameters.hpp @@ -22,7 +22,6 @@ namespace pyfiction inline void sidb_simulation_parameters(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, "sidb_simulation_parameters", DOC(fiction_sidb_simulation_parameters)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/sidb_simulation_result.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/sidb_simulation_result.hpp index b5ed86ec3..bc6244afb 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/sidb_simulation_result.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/sidb_simulation_result.hpp @@ -26,7 +26,6 @@ template void sidb_simulation_result(pybind11::module& m, const std::string& lattice = "") { namespace py = pybind11; - namespace py = pybind11; py::class_>(m, fmt::format("sidb_simulation_result{}", lattice).c_str(), DOC(fiction_sidb_simulation_result)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/inout/write_qca_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/inout/write_qca_layout.hpp index 296a7c84c..38403ea97 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/inout/write_qca_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/inout/write_qca_layout.hpp @@ -20,7 +20,6 @@ namespace pyfiction inline void write_qca_layout(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, "write_qca_layout_params", DOC(fiction_write_qca_layout_params)) .def(py::init<>()) diff --git a/bindings/mnt/pyfiction/include/pyfiction/inout/write_svg_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/inout/write_svg_layout.hpp index 6ba7888cc..9ee910865 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/inout/write_svg_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/inout/write_svg_layout.hpp @@ -64,7 +64,6 @@ inline void write_qca_layout_svg_impl(pybind11::module& m) void write_svg_layout(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::enum_(m, "color_mode", DOC(fiction_write_sidb_layout_svg_params_color_mode)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/layouts/cartesian_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/layouts/cartesian_layout.hpp index 0e9b9c1a4..61cd0573a 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/layouts/cartesian_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/layouts/cartesian_layout.hpp @@ -23,7 +23,6 @@ namespace pyfiction inline void cartesian_layout(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; /** * Cartesian layout. diff --git a/bindings/mnt/pyfiction/include/pyfiction/layouts/cell_level_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/layouts/cell_level_layout.hpp index 7a3312459..39d136a82 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/layouts/cell_level_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/layouts/cell_level_layout.hpp @@ -32,7 +32,6 @@ template void fcn_technology_cell_level_layout(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; // fetch technology name auto tech_name = std::string{fiction::tech_impl_name}; diff --git a/bindings/mnt/pyfiction/include/pyfiction/layouts/clocked_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/layouts/clocked_layout.hpp index 2486cf9cf..f1ef83dae 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/layouts/clocked_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/layouts/clocked_layout.hpp @@ -28,7 +28,6 @@ template void clocked_layout(pybind11::module& m, const std::string& topology) { namespace py = pybind11; - namespace py = pybind11; /** * Clocked Cartesian layout. diff --git a/bindings/mnt/pyfiction/include/pyfiction/layouts/coordinates.hpp b/bindings/mnt/pyfiction/include/pyfiction/layouts/coordinates.hpp index fe49ee028..b5c0ed70f 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/layouts/coordinates.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/layouts/coordinates.hpp @@ -32,7 +32,6 @@ namespace pyfiction inline void offset_coordinate(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, "offset_coordinate", DOC(fiction_offset_ucoord_t)) .def(py::init<>(), DOC(fiction_offset_ucoord_t_ucoord_t)) @@ -93,7 +92,6 @@ inline void offset_coordinate(pybind11::module& m) inline void cube_coordinate(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, "cube_coordinate", DOC(fiction_cube_coord_t)) .def(py::init<>(), DOC(fiction_cube_coord_t_coord_t)) @@ -150,7 +148,6 @@ inline void cube_coordinate(pybind11::module& m) inline void siqad_coordinate(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, "siqad_coordinate", DOC(fiction_siqad_coord_t)) .def(py::init<>(), DOC(fiction_siqad_coord_t_coord_t)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/layouts/gate_level_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/layouts/gate_level_layout.hpp index 2ee16d208..dda497234 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/layouts/gate_level_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/layouts/gate_level_layout.hpp @@ -29,7 +29,6 @@ template void gate_level_layout(pybind11::module& m, const std::string& topology) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, fmt::format("{}_gate_layout", topology).c_str(), DOC(fiction_gate_level_layout)) .def(py::init<>()) diff --git a/bindings/mnt/pyfiction/include/pyfiction/layouts/hexagonal_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/layouts/hexagonal_layout.hpp index 2ca20d37b..d36e872f4 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/layouts/hexagonal_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/layouts/hexagonal_layout.hpp @@ -22,7 +22,6 @@ namespace pyfiction inline void hexagonal_layout(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; /** * Hexagonal layout. diff --git a/bindings/mnt/pyfiction/include/pyfiction/layouts/obstruction_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/layouts/obstruction_layout.hpp index b846f1be6..694fc0069 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/layouts/obstruction_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/layouts/obstruction_layout.hpp @@ -22,7 +22,6 @@ template void obstruction_layout(pybind11::module& m, const std::string& topology) { namespace py = pybind11; - namespace py = pybind11; py::class_(m, fmt::format("{}_obstruction_layout", topology).c_str(), DOC(fiction_obstruction_layout)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/layouts/shifted_cartesian_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/layouts/shifted_cartesian_layout.hpp index e8a19f237..f7d81beff 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/layouts/shifted_cartesian_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/layouts/shifted_cartesian_layout.hpp @@ -23,7 +23,6 @@ namespace pyfiction inline void shifted_cartesian_layout(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; /** * Shifted Cartesian layout. diff --git a/bindings/mnt/pyfiction/include/pyfiction/networks/logic_networks.hpp b/bindings/mnt/pyfiction/include/pyfiction/networks/logic_networks.hpp index 65a100012..fb10fe4c0 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/networks/logic_networks.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/networks/logic_networks.hpp @@ -34,7 +34,6 @@ template void network(pybind11::module& m, const std::string& network_name) { namespace py = pybind11; - namespace py = pybind11; /** * Network node. diff --git a/bindings/mnt/pyfiction/include/pyfiction/technology/charge_distribution_surface.hpp b/bindings/mnt/pyfiction/include/pyfiction/technology/charge_distribution_surface.hpp index 088efdbfd..4ccf9c8c5 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/technology/charge_distribution_surface.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/technology/charge_distribution_surface.hpp @@ -32,7 +32,6 @@ template void charge_distribution_surface_layout(pybind11::module& m, const std::string& lattice = "") { namespace py = pybind11; - namespace py = pybind11; using py_cds = py_charge_distribution_surface_layout; diff --git a/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_charge_state.hpp b/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_charge_state.hpp index a5e7c0886..5ae5e328d 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_charge_state.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_charge_state.hpp @@ -17,7 +17,6 @@ namespace pyfiction inline void sidb_charge_state(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; py::enum_(m, "sidb_charge_state", DOC(fiction_sidb_charge_state)) .value("NEGATIVE", fiction::sidb_charge_state::NEGATIVE, DOC(fiction_sidb_charge_state_NEGATIVE)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_lattice.hpp b/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_lattice.hpp index 4fc8c310d..6f96e1efe 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_lattice.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_lattice.hpp @@ -32,7 +32,6 @@ template void sidb_lattice_cell_level_layout(pybind11::module& m) { namespace py = pybind11; - namespace py = pybind11; // fetch technology name auto orientation = std::string{fiction::sidb_lattice_name}; From d4217963ded8c0f865b257954f75e9ca8a99b712 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 18:34:53 +0100 Subject: [PATCH 04/42] :label: Complete type interface for coordinates --- bindings/mnt/pyfiction/pyfiction.pyi | 98 +++++++++++++++++++++++++--- 1 file changed, 90 insertions(+), 8 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index a4e5eeb9d..c44f71b36 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1,4 +1,4 @@ -from typing import overload +from typing import overload, Union class offset_coordinate: @@ -37,14 +37,96 @@ class offset_coordinate: def __hash__(self) -> int: ... -# TODO for cube_coordinate and siqad_coordinate -def offset_area(coord: offset_coordinate) -> int: ... -# def cube_area(coord: cube_coordinate) -> int: ... -# def siqad_area(coord: siqad_coordinate) -> int: ... +class cube_coordinate: + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, x: int, y: int, z: int = 0) -> None: ... + + @overload + def __init__(self, c: cube_coordinate) -> None: ... + + @overload + def __init__(self, c: tuple[int, int, int]) -> None: ... + + x: int + y: int + z: int + + def __eq__(self, other: object) -> bool: ... + + def __ne__(self, other: object) -> bool: ... + + def __lt__(self, other: cube_coordinate) -> bool: ... + + def __gt__(self, other: cube_coordinate) -> bool: ... + + def __le__(self, other: cube_coordinate) -> bool: ... + + def __ge__(self, other: cube_coordinate) -> bool: ... + + def __repr__(self) -> str: ... + + def __hash__(self) -> int: ... + + +class siqad_coordinate: + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, x: int, y: int, z: int = 0) -> None: ... + + @overload + def __init__(self, c: siqad_coordinate) -> None: ... + + @overload + def __init__(self, c: tuple[int, int, int]) -> None: ... + + x: int + y: int + z: int + + def __eq__(self, other: object) -> bool: ... + + def __ne__(self, other: object) -> bool: ... + + def __lt__(self, other: siqad_coordinate) -> bool: ... + + def __gt__(self, other: siqad_coordinate) -> bool: ... + + def __le__(self, other: siqad_coordinate) -> bool: ... + + def __ge__(self, other: siqad_coordinate) -> bool: ... + + def __repr__(self) -> str: ... + + def __hash__(self) -> int: ... + + +# For consistent behavior: +def area(coord: Union[offset_coordinate, cube_coordinate, siqad_coordinate]) -> float: ... + + +def volume(coord: Union[offset_coordinate, cube_coordinate, siqad_coordinate]) -> float: ... + + +# For conversions with potentially nuanced behavior: +@overload +def to_offset_coord(coord: siqad_coordinate) -> offset_coordinate: ... + + +@overload +def to_cube_coord(coord: siqad_coordinate) -> cube_coordinate: ... + + +@overload +def to_siqad_coord(coord: offset_coordinate) -> siqad_coordinate: ... + -def offset_volume(coord: offset_coordinate) -> int: ... -# def cube_volume(coord: cube_coordinate) -> int: ... -# def siqad_volume(coord: siqad_coordinate) -> int: ... +@overload +def to_siqad_coord(coord: cube_coordinate) -> siqad_coordinate: ... # ... From 0ad8c5432ff2325171dc8869d8f481d7c14b0bf7 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 19:01:34 +0100 Subject: [PATCH 05/42] :label: Type interface for all coordinate layouts --- bindings/mnt/pyfiction/pyfiction.pyi | 296 ++++++++++++++++++++++++++- 1 file changed, 294 insertions(+), 2 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index c44f71b36..8d3e28fe7 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1,4 +1,4 @@ -from typing import overload, Union +from typing import overload, Union, List, Optional class offset_coordinate: @@ -129,4 +129,296 @@ def to_siqad_coord(coord: offset_coordinate) -> siqad_coordinate: ... @overload def to_siqad_coord(coord: cube_coordinate) -> siqad_coordinate: ... -# ... + +class cartesian_layout: + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate) -> None: ... + + def coord(self, x: int, y: int, z: int = 0) -> offset_coordinate: ... + + def x(self) -> int: ... + + def y(self) -> int: ... + + def z(self) -> int: ... + + def area(self) -> int: ... + + def resize(self, dimension: offset_coordinate) -> None: ... + + def north(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def north_east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def south_east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def south(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def south_west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def north_west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def above(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def below(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def is_north_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_east_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_south_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_west_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_adjacent_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_adjacent_elevation_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_above(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_below(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_northwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_eastwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_southwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_westwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_at_northern_border(self, c: offset_coordinate) -> bool: ... + + def is_at_eastern_border(self, c: offset_coordinate) -> bool: ... + + def is_at_southern_border(self, c: offset_coordinate) -> bool: ... + + def is_at_western_border(self, c: offset_coordinate) -> bool: ... + + def is_at_any_border(self, c: offset_coordinate) -> bool: ... + + def northern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def eastern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def southern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def western_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def is_ground_layer(self, c: offset_coordinate) -> bool: ... + + def is_crossing_layer(self, c: offset_coordinate) -> bool: ... + + def is_within_bounds(self, c: offset_coordinate) -> bool: ... + + def offset_coordinates(self) -> List[offset_coordinate]: ... + + def ground_offset_coordinates(self) -> List[offset_coordinate]: ... + + def adjacent_offset_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... + + def adjacent_opposite_offset_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... + + def __repr__(self) -> str: ... + + +class shifted_cartesian_layout: + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate) -> None: ... + + def coord(self, x: int, y: int, z: int = 0) -> offset_coordinate: ... + + def x(self) -> int: ... + + def y(self) -> int: ... + + def z(self) -> int: ... + + def area(self) -> int: ... + + def resize(self, dimension: offset_coordinate) -> None: ... + + def north(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def north_east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def south_east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def south(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def south_west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def north_west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def above(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def below(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def is_north_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_east_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_south_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_west_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_adjacent_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_adjacent_elevation_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_above(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_below(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_northwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_eastwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_southwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_westwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... + + def is_at_northern_border(self, c: offset_coordinate) -> bool: ... + + def is_at_eastern_border(self, c: offset_coordinate) -> bool: ... + + def is_at_southern_border(self, c: offset_coordinate) -> bool: ... + + def is_at_western_border(self, c: offset_coordinate) -> bool: ... + + def is_at_any_border(self, c: offset_coordinate) -> bool: ... + + def northern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def eastern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def southern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def western_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... + + def is_ground_layer(self, c: offset_coordinate) -> bool: ... + + def is_crossing_layer(self, c: offset_coordinate) -> bool: ... + + def is_within_bounds(self, c: offset_coordinate) -> bool: ... + + def offset_coordinates(self) -> List[offset_coordinate]: ... + + def ground_offset_coordinates(self) -> List[offset_coordinate]: ... + + def adjacent_offset_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... + + def adjacent_opposite_offset_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... + + def __repr__(self) -> str: ... + + +class hexagonal_layout: + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: cube_coordinate) -> None: ... + + def coord(self, x: int, y: int, z: int = 0) -> cube_coordinate: ... + + def x(self) -> int: ... + + def y(self) -> int: ... + + def z(self) -> int: ... + + def area(self) -> int: ... + + def resize(self, dimension: cube_coordinate) -> None: ... + + def north(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def north_east(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def east(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def south_east(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def south(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def south_west(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def west(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def north_west(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def above(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def below(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def is_north_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_east_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_south_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_west_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_adjacent_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_adjacent_elevation_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_above(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_below(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_northwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_eastwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_southwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_westwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... + + def is_at_northern_border(self, c: cube_coordinate) -> bool: ... + + def is_at_eastern_border(self, c: cube_coordinate) -> bool: ... + + def is_at_southern_border(self, c: cube_coordinate) -> bool: ... + + def is_at_western_border(self, c: cube_coordinate) -> bool: ... + + def is_at_any_border(self, c: cube_coordinate) -> bool: ... + + def northern_border_of(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def eastern_border_of(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def southern_border_of(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def western_border_of(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... + + def is_ground_layer(self, c: cube_coordinate) -> bool: ... + + def is_crossing_layer(self, c: cube_coordinate) -> bool: ... + + def is_within_bounds(self, c: cube_coordinate) -> bool: ... + + def cube_coordinates(self) -> List[cube_coordinate]: ... + + def ground_cube_coordinates(self) -> List[cube_coordinate]: ... + + def adjacent_cube_coordinates(self, c: cube_coordinate) -> List[cube_coordinate]: ... + + def adjacent_opposite_cube_coordinates(self, c: cube_coordinate) -> List[cube_coordinate]: ... + + def __repr__(self) -> str: ... From b468f54a0f5a462c8bd82efc8b2db766641b3993 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 19:09:53 +0100 Subject: [PATCH 06/42] :label: Type interface for all clocked layouts --- bindings/mnt/pyfiction/pyfiction.pyi | 111 +++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 8d3e28fe7..864ceaabe 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -422,3 +422,114 @@ class hexagonal_layout: def adjacent_opposite_cube_coordinates(self, c: cube_coordinate) -> List[cube_coordinate]: ... def __repr__(self) -> str: ... + + +class clocked_cartesian_layout(cartesian_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave") -> None: ... + + def assign_clock_number(self, cz: offset_coordinate, cn: int) -> None: ... + + def get_clock_number(self, cz: offset_coordinate) -> int: ... + + def num_clocks(self) -> int: ... + + def is_regularly_clocked(self) -> bool: ... + + def is_clocking_scheme(self, name: str) -> bool: ... + + def is_incoming_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... + + def is_outgoing_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... + + def incoming_clocked_zones(self, cz: offset_coordinate) -> List[offset_coordinate]: ... + + def outgoing_clocked_zones(self, cz: offset_coordinate) -> List[offset_coordinate]: ... + + def in_degree(self, cz: offset_coordinate) -> int: ... + + def out_degree(self, cz: offset_coordinate) -> int: ... + + def degree(self, cz: offset_coordinate) -> int: ... + + def __repr__(self) -> str: ... + + +class clocked_shifted_cartesian_layout(shifted_cartesian_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave") -> None: ... + + def assign_clock_number(self, cz: offset_coordinate, cn: int) -> None: ... + + def get_clock_number(self, cz: offset_coordinate) -> int: ... + + def num_clocks(self) -> int: ... + + def is_regularly_clocked(self) -> bool: ... + + def is_clocking_scheme(self, name: str) -> bool: ... + + def is_incoming_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... + + def is_outgoing_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... + + def incoming_clocked_zones(self, cz: offset_coordinate) -> List[offset_coordinate]: ... + + def outgoing_clocked_zones(self, cz: offset_coordinate) -> List[offset_coordinate]: ... + + def in_degree(self, cz: offset_coordinate) -> int: ... + + def out_degree(self, cz: offset_coordinate) -> int: ... + + def degree(self, cz: offset_coordinate) -> int: ... + + def __repr__(self) -> str: ... + + +class clocked_hexagonal_layout(hexagonal_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: cube_coordinate) -> None: ... + + @overload + def __init__(self, dimension: cube_coordinate, clocking_scheme: str = "2DDWave") -> None: ... + + def assign_clock_number(self, cz: cube_coordinate, cn: int) -> None: ... + + def get_clock_number(self, cz: cube_coordinate) -> int: ... + + def num_clocks(self) -> int: ... + + def is_regularly_clocked(self) -> bool: ... + + def is_clocking_scheme(self, name: str) -> bool: ... + + def is_incoming_clocked(self, cz1: cube_coordinate, cz2: cube_coordinate) -> bool: ... + + def is_outgoing_clocked(self, cz1: cube_coordinate, cz2: cube_coordinate) -> bool: ... + + def incoming_clocked_zones(self, cz: cube_coordinate) -> List[cube_coordinate]: ... + + def outgoing_clocked_zones(self, cz: cube_coordinate) -> List[cube_coordinate]: ... + + def in_degree(self, cz: cube_coordinate) -> int: ... + + def out_degree(self, cz: cube_coordinate) -> int: ... + + def degree(self, cz: cube_coordinate) -> int: ... + + def __repr__(self) -> str: ... From edf4b0316eaabc0ad7840bc15eebd814d5d4ee47 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 19:21:12 +0100 Subject: [PATCH 07/42] :label: Type interface for all gate-level layouts --- bindings/mnt/pyfiction/pyfiction.pyi | 500 ++++++++++++++++++++++++++- 1 file changed, 499 insertions(+), 1 deletion(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 864ceaabe..2fdcda499 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1,4 +1,4 @@ -from typing import overload, Union, List, Optional +from typing import overload, Union, List, Optional, Tuple class offset_coordinate: @@ -533,3 +533,501 @@ class clocked_hexagonal_layout(hexagonal_layout): def degree(self, cz: cube_coordinate) -> int: ... def __repr__(self) -> str: ... + + +class cartesian_gate_layout(clocked_cartesian_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", + layout_name: str = "") -> None: ... + + def create_pi(self, name: str = "", t: Optional[offset_coordinate] = None) -> None: ... + + def create_po(self, s: int, name: str = "", t: Optional[offset_coordinate] = None) -> None: ... + + def is_pi(self, n: int) -> bool: ... + + def is_po(self, n: int) -> bool: ... + + def is_pi_offset_coordinate(self, t: offset_coordinate) -> bool: ... + + def is_po_offset_coordinate(self, t: offset_coordinate) -> bool: ... + + def is_inv(self) -> bool: ... + + def is_and(self) -> bool: ... + + def is_nand(self) -> bool: ... + + def is_or(self) -> bool: ... + + def is_nor(self) -> bool: ... + + def is_xor(self) -> bool: ... + + def is_xnor(self) -> bool: ... + + def is_maj(self) -> bool: ... + + def is_fanout(self) -> bool: ... + + def is_wire(self) -> bool: ... + + def set_layout_name(self, name: str) -> None: ... + + def get_layout_name(self) -> str: ... + + def set_input_name(self, index: int, name: str) -> None: ... + + def get_input_name(self, index: int) -> str: ... + + def set_output_name(self, index: int, name: str) -> None: ... + + def get_output_name(self, index: int) -> str: ... + + def get_name(self, s: int) -> str: ... + + def create_buf(self, a: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_not(self, a: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_and(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_nand(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_or(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_nor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_xor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_xnor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_maj(self, a: int, b: int, c: int, t: Optional[offset_coordinate] = None) -> None: ... + + def num_pis(self) -> int: ... + + def num_pos(self) -> int: ... + + def num_gates(self) -> int: ... + + def num_wires(self) -> int: ... + + def num_crossings(self) -> int: ... + + def is_empty(self) -> bool: ... + + def fanin_size(self, n: int) -> int: ... + + def fanout_size(self, n: int) -> int: ... + + def get_int(self, t: offset_coordinate) -> int: ... + + def get_offset_coordinate(self, n: int) -> offset_coordinate: ... + + def make_int(self, n: int) -> int: ... + + def move_int(self, n: int, t: offset_coordinate, new_children: List[offset_coordinate] = []) -> None: ... + + def clear_offset_coordinate(self, t: offset_coordinate) -> None: ... + + def is_gate_offset_coordinate(self, t: offset_coordinate) -> bool: ... + + def is_wire_offset_coordinate(self, t: offset_coordinate) -> bool: ... + + def is_empty_offset_coordinate(self, t: offset_coordinate) -> bool: ... + + def pis(self) -> List[offset_coordinate]: ... + + def pos(self) -> List[offset_coordinate]: ... + + def gates(self) -> List[offset_coordinate]: ... + + def wires(self) -> List[offset_coordinate]: ... + + def fanins(self, t: offset_coordinate) -> List[int]: ... + + def fanouts(self, t: offset_coordinate) -> List[int]: ... + + def is_incoming_int(self, t: offset_coordinate, s: int) -> bool: ... + + def has_no_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_northern_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_north_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_south_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_southern_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_south_western_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_western_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_north_western_incoming_int(self, t: offset_coordinate) -> bool: ... + + def is_outgoing_int(self, t: offset_coordinate, s: int) -> bool: ... + + def has_no_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_northern_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_north_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_south_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_southern_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_south_western_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_western_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_north_western_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... + + def is_dead(self, n: int) -> bool: ... + + def __repr__(self) -> str: ... + + +class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", + layout_name: str = "") -> None: ... + + def create_pi(self, name: str = "", t: Optional[offset_coordinate] = None) -> None: ... + + def create_po(self, s: int, name: str = "", t: Optional[offset_coordinate] = None) -> None: ... + + def is_pi(self, n: int) -> bool: ... + + def is_po(self, n: int) -> bool: ... + + def is_pi_offset_coordinate(self, t: offset_coordinate) -> bool: ... + + def is_po_offset_coordinate(self, t: offset_coordinate) -> bool: ... + + def is_inv(self) -> bool: ... + + def is_and(self) -> bool: ... + + def is_nand(self) -> bool: ... + + def is_or(self) -> bool: ... + + def is_nor(self) -> bool: ... + + def is_xor(self) -> bool: ... + + def is_xnor(self) -> bool: ... + + def is_maj(self) -> bool: ... + + def is_fanout(self) -> bool: ... + + def is_wire(self) -> bool: ... + + def set_layout_name(self, name: str) -> None: ... + + def get_layout_name(self) -> str: ... + + def set_input_name(self, index: int, name: str) -> None: ... + + def get_input_name(self, index: int) -> str: ... + + def set_output_name(self, index: int, name: str) -> None: ... + + def get_output_name(self, index: int) -> str: ... + + def get_name(self, s: int) -> str: ... + + def create_buf(self, a: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_not(self, a: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_and(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_nand(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_or(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_nor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_xor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_xnor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... + + def create_maj(self, a: int, b: int, c: int, t: Optional[offset_coordinate] = None) -> None: ... + + def num_pis(self) -> int: ... + + def num_pos(self) -> int: ... + + def num_gates(self) -> int: ... + + def num_wires(self) -> int: ... + + def num_crossings(self) -> int: ... + + def is_empty(self) -> bool: ... + + def fanin_size(self, n: int) -> int: ... + + def fanout_size(self, n: int) -> int: ... + + def get_int(self, t: offset_coordinate) -> int: ... + + def get_offset_coordinate(self, n: int) -> offset_coordinate: ... + + def make_int(self, n: int) -> int: ... + + def move_int(self, n: int, t: offset_coordinate, new_children: List[offset_coordinate] = []) -> None: ... + + def clear_offset_coordinate(self, t: offset_coordinate) -> None: ... + + def is_gate_offset_coordinate(self, t: offset_coordinate) -> bool: ... + + def is_wire_offset_coordinate(self, t: offset_coordinate) -> bool: ... + + def is_empty_offset_coordinate(self, t: offset_coordinate) -> bool: ... + + def pis(self) -> List[offset_coordinate]: ... + + def pos(self) -> List[offset_coordinate]: ... + + def gates(self) -> List[offset_coordinate]: ... + + def wires(self) -> List[offset_coordinate]: ... + + def fanins(self, t: offset_coordinate) -> List[int]: ... + + def fanouts(self, t: offset_coordinate) -> List[int]: ... + + def is_incoming_int(self, t: offset_coordinate, s: int) -> bool: ... + + def has_no_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_northern_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_north_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_south_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_southern_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_south_western_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_western_incoming_int(self, t: offset_coordinate) -> bool: ... + + def has_north_western_incoming_int(self, t: offset_coordinate) -> bool: ... + + def is_outgoing_int(self, t: offset_coordinate, s: int) -> bool: ... + + def has_no_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_northern_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_north_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_south_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_southern_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_south_western_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_western_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def has_north_western_outgoing_int(self, t: offset_coordinate) -> bool: ... + + def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... + + def is_dead(self, n: int) -> bool: ... + + def __repr__(self) -> str: ... + + +class hexagonal_gate_layout(clocked_hexagonal_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: cube_coordinate) -> None: ... + + @overload + def __init__(self, dimension: cube_coordinate, clocking_scheme: str = "2DDWave", + layout_name: str = "") -> None: ... + + def create_pi(self, name: str = "", t: Optional[cube_coordinate] = None) -> None: ... + + def create_po(self, s: int, name: str = "", t: Optional[cube_coordinate] = None) -> None: ... + + def is_pi(self, n: int) -> bool: ... + + def is_po(self, n: int) -> bool: ... + + def is_pi_cube_coordinate(self, t: cube_coordinate) -> bool: ... + + def is_po_cube_coordinate(self, t: cube_coordinate) -> bool: ... + + def is_inv(self) -> bool: ... + + def is_and(self) -> bool: ... + + def is_nand(self) -> bool: ... + + def is_or(self) -> bool: ... + + def is_nor(self) -> bool: ... + + def is_xor(self) -> bool: ... + + def is_xnor(self) -> bool: ... + + def is_maj(self) -> bool: ... + + def is_fanout(self) -> bool: ... + + def is_wire(self) -> bool: ... + + def set_layout_name(self, name: str) -> None: ... + + def get_layout_name(self) -> str: ... + + def set_input_name(self, index: int, name: str) -> None: ... + + def get_input_name(self, index: int) -> str: ... + + def set_output_name(self, index: int, name: str) -> None: ... + + def get_output_name(self, index: int) -> str: ... + + def get_name(self, s: int) -> str: ... + + def create_buf(self, a: int, t: Optional[cube_coordinate] = None) -> None: ... + + def create_not(self, a: int, t: Optional[cube_coordinate] = None) -> None: ... + + def create_and(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... + + def create_nand(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... + + def create_or(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... + + def create_nor(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... + + def create_xor(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... + + def create_xnor(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... + + def create_maj(self, a: int, b: int, c: int, t: Optional[cube_coordinate] = None) -> None: ... + + def num_pis(self) -> int: ... + + def num_pos(self) -> int: ... + + def num_gates(self) -> int: ... + + def num_wires(self) -> int: ... + + def num_crossings(self) -> int: ... + + def is_empty(self) -> bool: ... + + def fanin_size(self, n: int) -> int: ... + + def fanout_size(self, n: int) -> int: ... + + def get_int(self, t: cube_coordinate) -> int: ... + + def get_cube_coordinate(self, n: int) -> cube_coordinate: ... + + def make_int(self, n: int) -> int: ... + + def move_int(self, n: int, t: cube_coordinate, new_children: List[cube_coordinate] = []) -> None: ... + + def clear_cube_coordinate(self, t: cube_coordinate) -> None: ... + + def is_gate_cube_coordinate(self, t: cube_coordinate) -> bool: ... + + def is_wire_cube_coordinate(self, t: cube_coordinate) -> bool: ... + + def is_empty_cube_coordinate(self, t: cube_coordinate) -> bool: ... + + def pis(self) -> List[cube_coordinate]: ... + + def pos(self) -> List[cube_coordinate]: ... + + def gates(self) -> List[cube_coordinate]: ... + + def wires(self) -> List[cube_coordinate]: ... + + def fanins(self, t: cube_coordinate) -> List[int]: ... + + def fanouts(self, t: cube_coordinate) -> List[int]: ... + + def is_incoming_int(self, t: cube_coordinate, s: int) -> bool: ... + + def has_no_incoming_int(self, t: cube_coordinate) -> bool: ... + + def has_northern_incoming_int(self, t: cube_coordinate) -> bool: ... + + def has_north_eastern_incoming_int(self, t: cube_coordinate) -> bool: ... + + def has_eastern_incoming_int(self, t: cube_coordinate) -> bool: ... + + def has_south_eastern_incoming_int(self, t: cube_coordinate) -> bool: ... + + def has_southern_incoming_int(self, t: cube_coordinate) -> bool: ... + + def has_south_western_incoming_int(self, t: cube_coordinate) -> bool: ... + + def has_western_incoming_int(self, t: cube_coordinate) -> bool: ... + + def has_north_western_incoming_int(self, t: cube_coordinate) -> bool: ... + + def is_outgoing_int(self, t: cube_coordinate, s: int) -> bool: ... + + def has_no_outgoing_int(self, t: cube_coordinate) -> bool: ... + + def has_northern_outgoing_int(self, t: cube_coordinate) -> bool: ... + + def has_north_eastern_outgoing_int(self, t: cube_coordinate) -> bool: ... + + def has_eastern_outgoing_int(self, t: cube_coordinate) -> bool: ... + + def has_south_eastern_outgoing_int(self, t: cube_coordinate) -> bool: ... + + def has_southern_outgoing_int(self, t: cube_coordinate) -> bool: ... + + def has_south_western_outgoing_int(self, t: cube_coordinate) -> bool: ... + + def has_western_outgoing_int(self, t: cube_coordinate) -> bool: ... + + def has_north_western_outgoing_int(self, t: cube_coordinate) -> bool: ... + + def bounding_box_2d(self) -> Tuple[cube_coordinate, cube_coordinate]: ... + + def is_dead(self, n: int) -> bool: ... + + def __repr__(self) -> str: ... From 7f821384c989c21baaf84a43ce00155415a9ed0e Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 19:30:47 +0100 Subject: [PATCH 08/42] :label: Type interface for all cell-level layouts --- bindings/mnt/pyfiction/pyfiction.pyi | 177 +++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 2fdcda499..2086b4c4a 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1,4 +1,5 @@ from typing import overload, Union, List, Optional, Tuple +from enum import Enum class offset_coordinate: @@ -1031,3 +1032,179 @@ class hexagonal_gate_layout(clocked_hexagonal_layout): def is_dead(self, n: int) -> bool: ... def __repr__(self) -> str: ... + + +class qca_technology: + class cell_type(Enum): + EMPTY = ... + NORMAL = ... + INPUT = ... + OUTPUT = ... + CONST_0 = ... + CONST_1 = ... + + +class inml_technology: + class cell_type(Enum): + EMPTY = ... + NORMAL = ... + INPUT = ... + OUTPUT = ... + SLANTED_EDGE_UP_MAGNET = ... + SLANTED_EDGE_DOWN_MAGNET = ... + INVERTER_MAGNET = ... + CROSSWIRE_MAGNET = ... + FANOUT_COUPLER_MAGNET = ... + + +class sidb_technology: + class cell_type(Enum): + EMPTY = ... + NORMAL = ... + INPUT = ... + OUTPUT = ... + LOGIC = ... + + +class qca_layout(clocked_cartesian_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", + layout_name: str = "") -> None: ... + + def assign_cell_type(self, c: offset_coordinate, ct: qca_technology.cell_type) -> None: ... + + def get_cell_type(self, c: offset_coordinate) -> qca_technology.cell_type: ... + + def is_empty_cell(self, c: offset_coordinate) -> bool: ... + + def assign_cell_name(self, c: offset_coordinate, n: str) -> None: ... + + def get_cell_name(self, c: offset_coordinate) -> Optional[str]: ... + + def set_layout_name(self, name: str) -> None: ... + + def get_layout_name(self) -> str: ... + + def num_cells(self) -> int: ... + + def is_empty(self) -> bool: ... + + def num_pis(self) -> int: ... + + def num_pos(self) -> int: ... + + def is_pi(self, c: offset_coordinate) -> bool: ... + + def is_po(self, c: offset_coordinate) -> bool: ... + + def cells(self) -> List[offset_coordinate]: ... + + def pis(self) -> List[offset_coordinate]: ... + + def pos(self) -> List[offset_coordinate]: ... + + def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... + + def __repr__(self) -> str: ... + + +class inml_layout(clocked_cartesian_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", + layout_name: str = "") -> None: ... + + def assign_cell_type(self, c: offset_coordinate, ct: inml_technology.cell_type) -> None: ... + + def get_cell_type(self, c: offset_coordinate) -> inml_technology.cell_type: ... + + def is_empty_cell(self, c: offset_coordinate) -> bool: ... + + def assign_cell_name(self, c: offset_coordinate, n: str) -> None: ... + + def get_cell_name(self, c: offset_coordinate) -> Optional[str]: ... + + def set_layout_name(self, name: str) -> None: ... + + def get_layout_name(self) -> str: ... + + def num_cells(self) -> int: ... + + def is_empty(self) -> bool: ... + + def num_pis(self) -> int: ... + + def num_pos(self) -> int: ... + + def is_pi(self, c: offset_coordinate) -> bool: ... + + def is_po(self, c: offset_coordinate) -> bool: ... + + def cells(self) -> List[offset_coordinate]: ... + + def pis(self) -> List[offset_coordinate]: ... + + def pos(self) -> List[offset_coordinate]: ... + + def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... + + def __repr__(self) -> str: ... + + +class sidb_layout(clocked_cartesian_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate) -> None: ... + + @overload + def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", + layout_name: str = "") -> None: ... + + def assign_cell_type(self, c: offset_coordinate, ct: sidb_technology.cell_type) -> None: ... + + def get_cell_type(self, c: offset_coordinate) -> sidb_technology.cell_type: ... + + def is_empty_cell(self, c: offset_coordinate) -> bool: ... + + def assign_cell_name(self, c: offset_coordinate, n: str) -> None: ... + + def get_cell_name(self, c: offset_coordinate) -> Optional[str]: ... + + def set_layout_name(self, name: str) -> None: ... + + def get_layout_name(self) -> str: ... + + def num_cells(self) -> int: ... + + def is_empty(self) -> bool: ... + + def num_pis(self) -> int: ... + + def num_pos(self) -> int: ... + + def is_pi(self, c: offset_coordinate) -> bool: ... + + def is_po(self, c: offset_coordinate) -> bool: ... + + def cells(self) -> List[offset_coordinate]: ... + + def pis(self) -> List[offset_coordinate]: ... + + def pos(self) -> List[offset_coordinate]: ... + + def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... + + def __repr__(self) -> str: ... From 559237dda1a861f6d82700ed44667dee928b8a65 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 19:35:23 +0100 Subject: [PATCH 09/42] :pencil2: Fix copy-paste error --- bindings/mnt/pyfiction/pyfiction.pyi | 60 ++++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 2086b4c4a..bf3eb9e74 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -220,11 +220,11 @@ class cartesian_layout: def offset_coordinates(self) -> List[offset_coordinate]: ... - def ground_offset_coordinates(self) -> List[offset_coordinate]: ... + def ground_coordinates(self) -> List[offset_coordinate]: ... - def adjacent_offset_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... + def adjacent_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... - def adjacent_opposite_offset_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... + def adjacent_opposite_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... def __repr__(self) -> str: ... @@ -318,11 +318,11 @@ class shifted_cartesian_layout: def offset_coordinates(self) -> List[offset_coordinate]: ... - def ground_offset_coordinates(self) -> List[offset_coordinate]: ... + def ground_coordinates(self) -> List[offset_coordinate]: ... - def adjacent_offset_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... + def adjacent_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... - def adjacent_opposite_offset_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... + def adjacent_opposite_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... def __repr__(self) -> str: ... @@ -416,11 +416,11 @@ class hexagonal_layout: def cube_coordinates(self) -> List[cube_coordinate]: ... - def ground_cube_coordinates(self) -> List[cube_coordinate]: ... + def ground_coordinates(self) -> List[cube_coordinate]: ... - def adjacent_cube_coordinates(self, c: cube_coordinate) -> List[cube_coordinate]: ... + def adjacent_coordinates(self, c: cube_coordinate) -> List[cube_coordinate]: ... - def adjacent_opposite_cube_coordinates(self, c: cube_coordinate) -> List[cube_coordinate]: ... + def adjacent_opposite_coordinates(self, c: cube_coordinate) -> List[cube_coordinate]: ... def __repr__(self) -> str: ... @@ -555,9 +555,9 @@ class cartesian_gate_layout(clocked_cartesian_layout): def is_po(self, n: int) -> bool: ... - def is_pi_offset_coordinate(self, t: offset_coordinate) -> bool: ... + def is_pi_coordinate(self, t: offset_coordinate) -> bool: ... - def is_po_offset_coordinate(self, t: offset_coordinate) -> bool: ... + def is_po_coordinate(self, t: offset_coordinate) -> bool: ... def is_inv(self) -> bool: ... @@ -629,19 +629,19 @@ class cartesian_gate_layout(clocked_cartesian_layout): def get_int(self, t: offset_coordinate) -> int: ... - def get_offset_coordinate(self, n: int) -> offset_coordinate: ... + def get_coordinate(self, n: int) -> offset_coordinate: ... def make_int(self, n: int) -> int: ... def move_int(self, n: int, t: offset_coordinate, new_children: List[offset_coordinate] = []) -> None: ... - def clear_offset_coordinate(self, t: offset_coordinate) -> None: ... + def clear_coordinate(self, t: offset_coordinate) -> None: ... - def is_gate_offset_coordinate(self, t: offset_coordinate) -> bool: ... + def is_gate_coordinate(self, t: offset_coordinate) -> bool: ... - def is_wire_offset_coordinate(self, t: offset_coordinate) -> bool: ... + def is_wire_coordinate(self, t: offset_coordinate) -> bool: ... - def is_empty_offset_coordinate(self, t: offset_coordinate) -> bool: ... + def is_empty_coordinate(self, t: offset_coordinate) -> bool: ... def pis(self) -> List[offset_coordinate]: ... @@ -721,9 +721,9 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): def is_po(self, n: int) -> bool: ... - def is_pi_offset_coordinate(self, t: offset_coordinate) -> bool: ... + def is_pi_coordinate(self, t: offset_coordinate) -> bool: ... - def is_po_offset_coordinate(self, t: offset_coordinate) -> bool: ... + def is_po_coordinate(self, t: offset_coordinate) -> bool: ... def is_inv(self) -> bool: ... @@ -795,19 +795,19 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): def get_int(self, t: offset_coordinate) -> int: ... - def get_offset_coordinate(self, n: int) -> offset_coordinate: ... + def get_coordinate(self, n: int) -> offset_coordinate: ... def make_int(self, n: int) -> int: ... def move_int(self, n: int, t: offset_coordinate, new_children: List[offset_coordinate] = []) -> None: ... - def clear_offset_coordinate(self, t: offset_coordinate) -> None: ... + def clear_coordinate(self, t: offset_coordinate) -> None: ... - def is_gate_offset_coordinate(self, t: offset_coordinate) -> bool: ... + def is_gate_coordinate(self, t: offset_coordinate) -> bool: ... - def is_wire_offset_coordinate(self, t: offset_coordinate) -> bool: ... + def is_wire_coordinate(self, t: offset_coordinate) -> bool: ... - def is_empty_offset_coordinate(self, t: offset_coordinate) -> bool: ... + def is_empty_coordinate(self, t: offset_coordinate) -> bool: ... def pis(self) -> List[offset_coordinate]: ... @@ -887,9 +887,9 @@ class hexagonal_gate_layout(clocked_hexagonal_layout): def is_po(self, n: int) -> bool: ... - def is_pi_cube_coordinate(self, t: cube_coordinate) -> bool: ... + def is_pi_coordinate(self, t: cube_coordinate) -> bool: ... - def is_po_cube_coordinate(self, t: cube_coordinate) -> bool: ... + def is_po_coordinate(self, t: cube_coordinate) -> bool: ... def is_inv(self) -> bool: ... @@ -961,19 +961,19 @@ class hexagonal_gate_layout(clocked_hexagonal_layout): def get_int(self, t: cube_coordinate) -> int: ... - def get_cube_coordinate(self, n: int) -> cube_coordinate: ... + def get_coordinate(self, n: int) -> cube_coordinate: ... def make_int(self, n: int) -> int: ... def move_int(self, n: int, t: cube_coordinate, new_children: List[cube_coordinate] = []) -> None: ... - def clear_cube_coordinate(self, t: cube_coordinate) -> None: ... + def clear_coordinate(self, t: cube_coordinate) -> None: ... - def is_gate_cube_coordinate(self, t: cube_coordinate) -> bool: ... + def is_gate_coordinate(self, t: cube_coordinate) -> bool: ... - def is_wire_cube_coordinate(self, t: cube_coordinate) -> bool: ... + def is_wire_coordinate(self, t: cube_coordinate) -> bool: ... - def is_empty_cube_coordinate(self, t: cube_coordinate) -> bool: ... + def is_empty_coordinate(self, t: cube_coordinate) -> bool: ... def pis(self) -> List[cube_coordinate]: ... From 6113fd557261f2b1c6e1439b17cc6644c015572d Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 19:40:06 +0100 Subject: [PATCH 10/42] :label: Type interface for all obstruction layouts --- .../pyfiction/layouts/obstruction_layout.hpp | 2 + bindings/mnt/pyfiction/pyfiction.pyi | 72 +++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/bindings/mnt/pyfiction/include/pyfiction/layouts/obstruction_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/layouts/obstruction_layout.hpp index 694fc0069..c0e20b6f5 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/layouts/obstruction_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/layouts/obstruction_layout.hpp @@ -12,6 +12,8 @@ #include +#include + namespace pyfiction { diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index bf3eb9e74..e84c69327 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1034,6 +1034,78 @@ class hexagonal_gate_layout(clocked_hexagonal_layout): def __repr__(self) -> str: ... +class cartesian_obstruction_layout(cartesian_gate_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, layout: cartesian_gate_layout) -> None: ... + + def obstruct_coordinate(self, c: offset_coordinate) -> None: ... + + def obstruct_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... + + def is_obstructed_coordinate(self, c: offset_coordinate) -> bool: ... + + def is_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> bool: ... + + def clear_obstructed_coordinate(self, c: offset_coordinate) -> None: ... + + def clear_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... + + def clear_obstructed_coordinates(self) -> None: ... + + def clear_obstructed_connections(self) -> None: ... + + +class shifted_cartesian_obstruction_layout(shifted_cartesian_gate_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, layout: shifted_cartesian_gate_layout) -> None: ... + + def obstruct_coordinate(self, c: offset_coordinate) -> None: ... + + def obstruct_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... + + def is_obstructed_coordinate(self, c: offset_coordinate) -> bool: ... + + def is_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> bool: ... + + def clear_obstructed_coordinate(self, c: offset_coordinate) -> None: ... + + def clear_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... + + def clear_obstructed_coordinates(self) -> None: ... + + def clear_obstructed_connections(self) -> None: ... + + +class hexagonal_obstruction_layout(hexagonal_gate_layout): + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, layout: hexagonal_gate_layout) -> None: ... + + def obstruct_coordinate(self, c: cube_coordinate) -> None: ... + + def obstruct_connection(self, src: cube_coordinate, tgt: cube_coordinate) -> None: ... + + def is_obstructed_coordinate(self, c: cube_coordinate) -> bool: ... + + def is_obstructed_connection(self, src: cube_coordinate, tgt: cube_coordinate) -> bool: ... + + def clear_obstructed_coordinate(self, c: cube_coordinate) -> None: ... + + def clear_obstructed_connection(self, src: cube_coordinate, tgt: cube_coordinate) -> None: ... + + def clear_obstructed_coordinates(self) -> None: ... + + def clear_obstructed_connections(self) -> None: ... + + class qca_technology: class cell_type(Enum): EMPTY = ... From 5641f9f7e2930de9aa0a9adbb28b42ac4630e5b6 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 19:48:17 +0100 Subject: [PATCH 11/42] :label: Type interface for `technology_network` --- .../pyfiction/networks/logic_networks.hpp | 5 +- bindings/mnt/pyfiction/pyfiction.pyi | 71 +++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/networks/logic_networks.hpp b/bindings/mnt/pyfiction/include/pyfiction/networks/logic_networks.hpp index fb10fe4c0..167a9314c 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/networks/logic_networks.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/networks/logic_networks.hpp @@ -148,7 +148,10 @@ void network(pybind11::module& m, const std::string& network_name) py::arg("index")) .def( "po_index", [](const Ntk& ntk, const mockturtle::node& n) { return ntk.po_index(n); }, py::arg("n")) - .def("po_at", [](const Ntk& ntk, const uint32_t index) { return ntk.po_at(index); }, py::arg("index")); + .def( + "po_at", [](const Ntk& ntk, const uint32_t index) { return ntk.po_at(index); }, py::arg("index")) + + ; /** * Network parsing function. diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index e84c69327..9142bc092 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -2,6 +2,8 @@ from typing import overload, Union, List, Optional, Tuple from enum import Enum +# Layouts + class offset_coordinate: @overload def __init__(self) -> None: ... @@ -1280,3 +1282,72 @@ class sidb_layout(clocked_cartesian_layout): def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... def __repr__(self) -> str: ... + + +# Networks + +class technology_network_node: + def __hash__(self) -> int: ... + + +class technology_network: + def __init__(self) -> None: ... + + def size(self) -> int: ... + + def num_gates(self) -> int: ... + + def num_pis(self) -> int: ... + + def num_pos(self) -> int: ... + + def nodes(self) -> List[technology_network_node]: ... + + def gates(self) -> List[technology_network_node]: ... + + def pis(self) -> List[technology_network_node]: ... + + def pos(self) -> List[technology_network_node]: ... + + def fanins(self, n: technology_network_node) -> List[technology_network_node]: ... + + def is_constant(self, n: technology_network_node) -> bool: ... + + def is_pi(self, n: technology_network_node) -> bool: ... + + def is_po(self, n: technology_network_node) -> bool: ... + + def is_buf(self, n: technology_network_node) -> bool: ... + + def is_fanout(self, n: technology_network_node) -> bool: ... + + def is_inv(self, n: technology_network_node) -> bool: ... + + def is_and(self, n: technology_network_node) -> bool: ... + + def is_or(self, n: technology_network_node) -> bool: ... + + def is_xor(self, n: technology_network_node) -> bool: ... + + def is_maj(self, n: technology_network_node) -> bool: ... + + def is_nand(self, n: technology_network_node) -> bool: ... + + def is_nor(self, n: technology_network_node) -> bool: ... + + def is_xnor(self, n: technology_network_node) -> bool: ... + + def has_name(self, n: technology_network_node) -> bool: ... + + def get_name(self, n: technology_network_node) -> Optional[str]: ... + + def has_output_name(self, index: int) -> bool: ... + + def get_output_name(self, index: int) -> Optional[str]: ... + + def po_index(self, n: technology_network_node) -> int: ... + + def po_at(self, index: int) -> technology_network_node: ... + + +def read_technology_network(filename: str) -> technology_network: ... From 7d199164990e7bba8030eed584b8fcecdd511b9f Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 19:51:46 +0100 Subject: [PATCH 12/42] :label: Type interface for `dynamic_truth_table` --- .../include/pyfiction/networks/truth_tables.hpp | 5 +++-- bindings/mnt/pyfiction/pyfiction.pyi | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/networks/truth_tables.hpp b/bindings/mnt/pyfiction/include/pyfiction/networks/truth_tables.hpp index c11318d09..f808e7aa3 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/networks/truth_tables.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/networks/truth_tables.hpp @@ -8,7 +8,8 @@ #include "pyfiction/types.hpp" #include -#include + +#include namespace pyfiction { @@ -19,7 +20,7 @@ inline void truth_tables(pybind11::module& m) py::class_(m, "dynamic_truth_table") .def(py::init<>()) - .def(py::init()) + .def(py::init(), py::arg("num_vars")) .def("num_vars", &py_tt::num_vars) .def("num_blocks", &py_tt::num_blocks) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 9142bc092..29e5a2aad 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1351,3 +1351,17 @@ class technology_network: def read_technology_network(filename: str) -> technology_network: ... + + +class dynamic_truth_table: + @overload + def __init__(self) -> None: ... + + @overload + def __init__(self, num_vars: int) -> None: ... + + def num_vars(self) -> int: ... + + def num_blocks(self) -> int: ... + + def num_bits(self) -> int: ... From 189a135838605441acc0f32175b5eeac7ea734d6 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 19:59:01 +0100 Subject: [PATCH 13/42] :label: Type interface for `a_star` --- bindings/mnt/pyfiction/pyfiction.pyi | 58 +++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 29e5a2aad..1575b27dd 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -416,7 +416,7 @@ class hexagonal_layout: def is_within_bounds(self, c: cube_coordinate) -> bool: ... - def cube_coordinates(self) -> List[cube_coordinate]: ... + def coordinates(self) -> List[cube_coordinate]: ... def ground_coordinates(self) -> List[cube_coordinate]: ... @@ -1365,3 +1365,59 @@ class dynamic_truth_table: def num_blocks(self) -> int: ... def num_bits(self) -> int: ... + + +# Algorithms + +## path finding + +class a_star_params: + def __init__(self): ... + + crossings: bool + + +@overload +def a_star(layout: cartesian_obstruction_layout, source: offset_coordinate, target: offset_coordinate, + params: a_star_params) -> List[offset_coordinate]: ... + + +@overload +def a_star(layout: cartesian_gate_layout, source: offset_coordinate, target: offset_coordinate, + params: a_star_params) -> List[offset_coordinate]: ... + + +@overload +def a_star(layout: cartesian_layout, source: offset_coordinate, target: offset_coordinate, params: a_star_params) -> \ + List[offset_coordinate]: ... + + +@overload +def a_star(layout: shifted_cartesian_obstruction_layout, source: offset_coordinate, target: offset_coordinate, + params: a_star_params) -> List[offset_coordinate]: ... + + +@overload +def a_star(layout: shifted_cartesian_gate_layout, source: offset_coordinate, target: offset_coordinate, + params: a_star_params) -> List[offset_coordinate]: ... + + +@overload +def a_star(layout: shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate, + params: a_star_params) -> \ + List[offset_coordinate]: ... + + +@overload +def a_star(layout: hexagonal_obstruction_layout, source: cube_coordinate, target: cube_coordinate, + params: a_star_params) -> List[cube_coordinate]: ... + + +@overload +def a_star(layout: hexagonal_gate_layout, source: cube_coordinate, target: cube_coordinate, + params: a_star_params) -> List[cube_coordinate]: ... + + +@overload +def a_star(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate, params: a_star_params) -> \ + List[cube_coordinate]: ... From 6fbfef9fefbb44d7406858d9d9a69a6f4bf200d2 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 20:04:39 +0100 Subject: [PATCH 14/42] :label: Adjusted type interface for `a_star` --- bindings/mnt/pyfiction/pyfiction.pyi | 63 ++++++++++------------------ 1 file changed, 23 insertions(+), 40 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 1575b27dd..bace9a7d5 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1378,46 +1378,29 @@ class a_star_params: @overload -def a_star(layout: cartesian_obstruction_layout, source: offset_coordinate, target: offset_coordinate, - params: a_star_params) -> List[offset_coordinate]: ... +def a_star( + layout: Union[ + cartesian_obstruction_layout, + cartesian_gate_layout, + cartesian_layout, + shifted_cartesian_obstruction_layout, + shifted_cartesian_gate_layout, + shifted_cartesian_layout + ], + source: offset_coordinate, + target: offset_coordinate, + params: a_star_params +) -> List[offset_coordinate]: ... @overload -def a_star(layout: cartesian_gate_layout, source: offset_coordinate, target: offset_coordinate, - params: a_star_params) -> List[offset_coordinate]: ... - - -@overload -def a_star(layout: cartesian_layout, source: offset_coordinate, target: offset_coordinate, params: a_star_params) -> \ - List[offset_coordinate]: ... - - -@overload -def a_star(layout: shifted_cartesian_obstruction_layout, source: offset_coordinate, target: offset_coordinate, - params: a_star_params) -> List[offset_coordinate]: ... - - -@overload -def a_star(layout: shifted_cartesian_gate_layout, source: offset_coordinate, target: offset_coordinate, - params: a_star_params) -> List[offset_coordinate]: ... - - -@overload -def a_star(layout: shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate, - params: a_star_params) -> \ - List[offset_coordinate]: ... - - -@overload -def a_star(layout: hexagonal_obstruction_layout, source: cube_coordinate, target: cube_coordinate, - params: a_star_params) -> List[cube_coordinate]: ... - - -@overload -def a_star(layout: hexagonal_gate_layout, source: cube_coordinate, target: cube_coordinate, - params: a_star_params) -> List[cube_coordinate]: ... - - -@overload -def a_star(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate, params: a_star_params) -> \ - List[cube_coordinate]: ... +def a_star( + layout: Union[ + hexagonal_obstruction_layout, + hexagonal_gate_layout, + hexagonal_layout + ], + source: cube_coordinate, + target: cube_coordinate, + params: a_star_params +) -> List[cube_coordinate]: ... From 4e066841f53b83b8b52d6c69fcb0f3285071e6a2 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 20:04:52 +0100 Subject: [PATCH 15/42] :label: Type interface for distance functions --- bindings/mnt/pyfiction/pyfiction.pyi | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index bace9a7d5..170d868f6 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1371,6 +1371,54 @@ class dynamic_truth_table: ## path finding +from typing import overload, Union + + +@overload +def manhattan_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, + target: offset_coordinate) -> int: ... + + +@overload +def manhattan_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... + + +@overload +def euclidean_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, + target: offset_coordinate) -> float: ... + + +@overload +def euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... + + +@overload +def squared_euclidean_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, + target: offset_coordinate) -> float: ... + + +@overload +def squared_euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... + + +@overload +def twoddwave_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, + target: offset_coordinate) -> int: ... + + +@overload +def twoddwave_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... + + +@overload +def chebyshev_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, + target: offset_coordinate) -> int: ... + + +@overload +def chebyshev_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... + + class a_star_params: def __init__(self): ... From 73bf524334bb0824eedf403b6662c2e4462c525b Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 20:07:56 +0100 Subject: [PATCH 16/42] :label: Type interface for `enumerate_all_paths` --- bindings/mnt/pyfiction/pyfiction.pyi | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 170d868f6..f3eefff0f 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1452,3 +1452,38 @@ def a_star( target: cube_coordinate, params: a_star_params ) -> List[cube_coordinate]: ... + + +class enumerate_all_paths_params: + def __init__(self): ... + + crossings: bool + + +@overload +def enumerate_all_paths( + layout: Union[ + cartesian_obstruction_layout, + cartesian_gate_layout, + cartesian_layout, + shifted_cartesian_obstruction_layout, + shifted_cartesian_gate_layout, + shifted_cartesian_layout + ], + source: offset_coordinate, + target: offset_coordinate, + params: a_star_params +) -> List[List[offset_coordinate]]: ... + + +@overload +def enumerate_all_paths( + layout: Union[ + hexagonal_obstruction_layout, + hexagonal_gate_layout, + hexagonal_layout + ], + source: cube_coordinate, + target: cube_coordinate, + params: a_star_params +) -> List[List[cube_coordinate]]: ... From e35e38af47d6e58dc3d26f504b3008fe5d37a95b Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 20:12:11 +0100 Subject: [PATCH 17/42] :label: Type interface for `yen_k_shortest_paths` --- .../path_finding/k_shortest_paths.hpp | 2 +- bindings/mnt/pyfiction/pyfiction.pyi | 41 ++++++++++++++++++- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/path_finding/k_shortest_paths.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/path_finding/k_shortest_paths.hpp index 1e574bbfa..0052a4b04 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/path_finding/k_shortest_paths.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/path_finding/k_shortest_paths.hpp @@ -60,7 +60,7 @@ inline void yen_k_shortest_paths(pybind11::module& m) py::class_(m, "yen_k_shortest_paths_params", DOC(fiction_yen_k_shortest_paths_params)) .def(py::init<>()) - .def_readwrite("a_star_params", &fiction::yen_k_shortest_paths_params::astar_params, + .def_readwrite("astar_params", &fiction::yen_k_shortest_paths_params::astar_params, DOC(fiction_yen_k_shortest_paths_params_astar_params)) ; diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index f3eefff0f..5c362f120 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1472,7 +1472,7 @@ def enumerate_all_paths( ], source: offset_coordinate, target: offset_coordinate, - params: a_star_params + params: enumerate_all_paths_params ) -> List[List[offset_coordinate]]: ... @@ -1485,5 +1485,42 @@ def enumerate_all_paths( ], source: cube_coordinate, target: cube_coordinate, - params: a_star_params + params: enumerate_all_paths_params +) -> List[List[cube_coordinate]]: ... + + +class yen_k_shortest_paths_params: + def __init__(self): ... + + astar_params: a_star_params + + +@overload +def yen_k_shortest_paths( + layout: Union[ + cartesian_obstruction_layout, + cartesian_gate_layout, + cartesian_layout, + shifted_cartesian_obstruction_layout, + shifted_cartesian_gate_layout, + shifted_cartesian_layout + ], + source: offset_coordinate, + target: offset_coordinate, + k: int, + params: yen_k_shortest_paths_params +) -> List[List[offset_coordinate]]: ... + + +@overload +def yen_k_shortest_paths( + layout: Union[ + hexagonal_obstruction_layout, + hexagonal_gate_layout, + hexagonal_layout + ], + source: cube_coordinate, + target: cube_coordinate, + k: int, + params: yen_k_shortest_paths_params ) -> List[List[cube_coordinate]]: ... From fb8d3d795e87e6f7ca1f91db7ced339bcb573e00 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 20:24:14 +0100 Subject: [PATCH 18/42] :label: Type interface for all network transformations --- .../technology_mapping.hpp | 4 +- bindings/mnt/pyfiction/pyfiction.pyi | 94 +++++++++++++++++++ 2 files changed, 95 insertions(+), 3 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/network_transformation/technology_mapping.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/network_transformation/technology_mapping.hpp index f5a78d634..143264d16 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/network_transformation/technology_mapping.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/network_transformation/technology_mapping.hpp @@ -73,9 +73,7 @@ inline void technology_mapping(pybind11::module& m) py::class_(m, "technology_mapping_stats", DOC(fiction_technology_mapping_stats)) .def(py::init<>()) .def("__repr__", [](const fiction::technology_mapping_stats& stats) { return stats.report(); }) - .def("report", &fiction::technology_mapping_stats::report, DOC(fiction_technology_mapping_stats_report)) - .def_readonly("mapper_stats", &fiction::technology_mapping_stats::mapper_stats, - DOC(fiction_technology_mapping_stats_mapper_stats)); + .def("report", &fiction::technology_mapping_stats::report, DOC(fiction_technology_mapping_stats_report)); m.def("and_or_not", &fiction::and_or_not, DOC(fiction_and_or_not)); diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 5c362f120..8288c4854 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1369,6 +1369,100 @@ class dynamic_truth_table: # Algorithms +## network transformation + + +class substitution_strategy: + BREADTH: int + DEPTH: int + + +class fanout_substitution_params: + def __init__(self) -> None: ... + + strategy: substitution_strategy + degree: Optional[int] + threshold: Optional[int] + + +def fanout_substitution(network: technology_network, + params: Optional[ + fanout_substitution_params] = fanout_substitution_params()) -> technology_network: ... + + +def is_fanout_substituted(network: technology_network, + params: Optional[fanout_substitution_params] = fanout_substitution_params()) -> bool: ... + + +class network_balancing_params: + def __init__(self) -> None: ... + + unify_outputs: bool + + +def network_balancing(network: technology_network, + params: Optional[ + network_balancing_params] = network_balancing_params()) -> technology_network: ... + + +def is_balanced(network: technology_network, + params: Optional[network_balancing_params] = network_balancing_params()) -> bool: ... + + +from typing import Optional, List + + +class technology_mapping_params: + def __init__(self) -> None: ... + + decay: Optional[float] + inv: Optional[bool] + and2: Optional[bool] + nand2: Optional[bool] + or2: Optional[bool] + nor2: Optional[bool] + xor2: Optional[bool] + xnor2: Optional[bool] + and3: Optional[bool] + xor_and: Optional[bool] + or_and: Optional[bool] + onehot: Optional[bool] + maj3: Optional[bool] + gamble: Optional[bool] + dot: Optional[bool] + mux: Optional[bool] + and_xor: Optional[bool] + + +class technology_mapping_stats: + + def __init__(self) -> None: ... + + def report(self) -> str: ... + + def __repr__(self) -> str: ... + + +def and_or_not() -> technology_mapping_params: ... + + +def and_or_not_maj() -> technology_mapping_params: ... + + +def all_standard_2_input_functions() -> technology_mapping_params: ... + + +def all_standard_3_input_functions() -> technology_mapping_params: ... + + +def all_supported_standard_functions() -> technology_mapping_params: ... + + +def technology_mapping(network: technology_network, + params: Optional[technology_mapping_params] = technology_mapping_params(), + stats: Optional[technology_mapping_stats] = None) -> technology_network: ... + + ## path finding from typing import overload, Union From ee344bf13a0013ad9be0e6766c2d1b5553c10fb3 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 20:24:26 +0100 Subject: [PATCH 19/42] :bug: Fixed copy-paste errors --- bindings/mnt/pyfiction/pyfiction.pyi | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 8288c4854..f6593a46e 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1465,8 +1465,6 @@ def technology_mapping(network: technology_network, ## path finding -from typing import overload, Union - @overload def manhattan_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, @@ -1531,7 +1529,7 @@ def a_star( ], source: offset_coordinate, target: offset_coordinate, - params: a_star_params + params: Optional[a_star_params] = a_star_params() ) -> List[offset_coordinate]: ... @@ -1544,7 +1542,7 @@ def a_star( ], source: cube_coordinate, target: cube_coordinate, - params: a_star_params + params: Optional[a_star_params] = a_star_params() ) -> List[cube_coordinate]: ... @@ -1566,7 +1564,7 @@ def enumerate_all_paths( ], source: offset_coordinate, target: offset_coordinate, - params: enumerate_all_paths_params + params: Optional[enumerate_all_paths_params] = enumerate_all_paths_params() ) -> List[List[offset_coordinate]]: ... @@ -1579,7 +1577,7 @@ def enumerate_all_paths( ], source: cube_coordinate, target: cube_coordinate, - params: enumerate_all_paths_params + params: Optional[enumerate_all_paths_params] = enumerate_all_paths_params() ) -> List[List[cube_coordinate]]: ... @@ -1602,7 +1600,7 @@ def yen_k_shortest_paths( source: offset_coordinate, target: offset_coordinate, k: int, - params: yen_k_shortest_paths_params + params: Optional[yen_k_shortest_paths_params] = yen_k_shortest_paths_params() ) -> List[List[offset_coordinate]]: ... @@ -1616,5 +1614,5 @@ def yen_k_shortest_paths( source: cube_coordinate, target: cube_coordinate, k: int, - params: yen_k_shortest_paths_params + params: Optional[yen_k_shortest_paths_params] = yen_k_shortest_paths_params() ) -> List[List[cube_coordinate]]: ... From 236f63c29d28c241f25dc2b7d88ce2d33b714fe0 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 20:31:50 +0100 Subject: [PATCH 20/42] =?UTF-8?q?:label:=20Type=20interface=20for=20nm?= =?UTF-8?q?=C2=B2=20area=20computations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bindings/mnt/pyfiction/pyfiction.pyi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index f6593a46e..d4ed25926 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1616,3 +1616,18 @@ def yen_k_shortest_paths( k: int, params: Optional[yen_k_shortest_paths_params] = yen_k_shortest_paths_params() ) -> List[List[cube_coordinate]]: ... + + +# Technology + +@overload +def area(layout: qca_layout, width: int = 18, height: int = 18, hspace: int = 2, vspace: int = 2) -> float: ... + + +@overload +def area(layout: inml_layout, width: int = 50, height: int = 100, hspace: int = 10, vspace: int = 25) -> float: ... + + +@overload +def area(layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, + vspace: float = 0.384) -> float: ... From 086ec43f4482129ef06a4ce189ade3897eb9d83d Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 3 Dec 2024 20:36:35 +0100 Subject: [PATCH 21/42] :label: Type interface for gate library application and CP/TP calculation --- bindings/mnt/pyfiction/pyfiction.pyi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index d4ed25926..8de02921b 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1618,6 +1618,24 @@ def yen_k_shortest_paths( ) -> List[List[cube_coordinate]]: ... +# physical design + +def apply_qca_one_library(layout: cartesian_gate_layout) -> qca_layout: ... + + +def apply_topolinano_library(layout: shifted_cartesian_gate_layout) -> inml_layout: ... + + +def apply_bestagon_library(layout: hexagonal_gate_layout) -> sidb_layout: ... + + +# properties + +def critical_path_length_and_throughput( + layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout]) -> Tuple[ + int, int]: ... + + # Technology @overload From 3bf681149270a18e941a1b4ffef47359c064ad70 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Wed, 4 Dec 2024 09:10:57 +0100 Subject: [PATCH 22/42] :label: Type interface for `color_routing` --- bindings/mnt/pyfiction/pyfiction.pyi | 36 +++++++++++++++++++ .../physical_design/color_routing.hpp | 6 ++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 8de02921b..449e17d0e 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1629,6 +1629,42 @@ def apply_topolinano_library(layout: shifted_cartesian_gate_layout) -> inml_layo def apply_bestagon_library(layout: hexagonal_gate_layout) -> sidb_layout: ... +class graph_coloring_engine(Enum): + MCS = ... + DSATUR = ... + LMXRLF = ... + TABUCOL = ... + SAT = ... + + +class color_routing_params: + def __init__(self) -> None: ... + + conduct_partial_routing: bool + crossings: bool + path_limit: Optional[int] + engine: graph_coloring_engine + partial_sat: bool + + +@overload +def color_routing( + layout: Union[ + cartesian_obstruction_layout, cartesian_gate_layout, shifted_cartesian_obstruction_layout, shifted_cartesian_gate_layout], + objectives: List[Tuple[offset_coordinate, offset_coordinate]], + params: Optional[color_routing_params] = color_routing_params() +) -> bool: ... + + +@overload +def color_routing( + layout: Union[ + hexagonal_obstruction_layout, hexagonal_gate_layout], + objectives: List[Tuple[cube_coordinate, cube_coordinate]], + params: Optional[color_routing_params] = color_routing_params() +) -> bool: ... + + # properties def critical_path_length_and_throughput( diff --git a/include/fiction/algorithms/physical_design/color_routing.hpp b/include/fiction/algorithms/physical_design/color_routing.hpp index 2b76f8ff3..c93c72e14 100644 --- a/include/fiction/algorithms/physical_design/color_routing.hpp +++ b/include/fiction/algorithms/physical_design/color_routing.hpp @@ -10,12 +10,12 @@ #include "fiction/traits.hpp" #include "fiction/utils/routing_utils.hpp" -#include #include #include -#include -#include +#include +#include +#include #include namespace fiction From 5528c98d33b0b379eb05547e7a955f0a9043b18a Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Wed, 4 Dec 2024 12:35:05 +0100 Subject: [PATCH 23/42] :label: Type interface for `exact` and `orthogonal` --- .../algorithms/physical_design/exact.hpp | 3 +- .../algorithms/physical_design/orthogonal.hpp | 1 - bindings/mnt/pyfiction/pyfiction.pyi | 90 ++++++++++++++++++- .../algorithms/physical_design/exact.hpp | 10 +-- 4 files changed, 95 insertions(+), 9 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/exact.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/exact.hpp index 0f1061566..1c38ce76d 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/exact.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/exact.hpp @@ -13,7 +13,6 @@ #include #include -#include #include @@ -38,6 +37,8 @@ inline void exact(pybind11::module& m) .def(py::init<>()) .def_readwrite("scheme", &fiction::exact_physical_design_params::scheme, DOC(fiction_exact_physical_design_params_scheme)) + .def_readwrite("upper_bound_area", &fiction::exact_physical_design_params::upper_bound_area, + DOC(fiction_exact_physical_design_params_upper_bound_area)) .def_readwrite("upper_bound_x", &fiction::exact_physical_design_params::upper_bound_x, DOC(fiction_exact_physical_design_params_upper_bound_x)) .def_readwrite("upper_bound_y", &fiction::exact_physical_design_params::upper_bound_y, diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/orthogonal.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/orthogonal.hpp index da80a40a4..3892cd461 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/orthogonal.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/orthogonal.hpp @@ -11,7 +11,6 @@ #include #include -#include #include diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 449e17d0e..632e0b906 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1438,7 +1438,7 @@ class technology_mapping_stats: def __init__(self) -> None: ... - def report(self) -> str: ... + def report(self) -> None: ... def __repr__(self) -> str: ... @@ -1665,6 +1665,94 @@ def color_routing( ) -> bool: ... +class technology_constraints(Enum): + NONE: ... + TOPOLINANO: ... + + +class exact_params: + + def __init__(self) -> None: ... + + scheme: str + upper_bound_area: int + upper_bound_x: int + upper_bound_y: int + fixed_size: bool + num_threads: int + crossings: bool + border_io: bool + straight_inverters: bool + desynchronize: bool + minimize_wires: bool + minimize_crossings: bool + timeout: int + technology_specifics: technology_constraints + + +class exact_stats: + time_total: float + x_size: int + y_size: int + num_gates: int + num_wires: int + num_crossings: int + num_aspect_ratios: int + + def __init__(self) -> None: ... + + def report(self) -> str: ... + + def __repr__(self) -> str: ... + + +def exact_cartesian( + network: technology_network, + parameters: Optional[exact_params] = None, + statistics: Optional[exact_stats] = None +) -> cartesian_gate_layout: ... + + +def exact_shifted_cartesian( + network: technology_network, + parameters: Optional[exact_params] = None, + statistics: Optional[exact_stats] = None +) -> shifted_cartesian_gate_layout: ... + + +def exact_hexagonal( + network: technology_network, + parameters: Optional[exact_params] = None, + statistics: Optional[exact_stats] = None +) -> hexagonal_gate_layout: ... + + +class orthogonal_params: + def __init__(self) -> None: ... + + +class orthogonal_stats: + time_total: float + x_size: int + y_size: int + num_gates: int + num_wires: int + num_crossings: int + + def __init__(self) -> None: ... + + def report(self) -> None: ... + + def __repr__(self) -> str: ... + + +def orthogonal( + network: technology_network, + parameters: Optional[orthogonal_params] = orthogonal_params(), + statistics: Optional[orthogonal_stats] = None +) -> cartesian_gate_layout: ... + + # properties def critical_path_length_and_throughput( diff --git a/include/fiction/algorithms/physical_design/exact.hpp b/include/fiction/algorithms/physical_design/exact.hpp index 12f5eb7dd..dcb7d66c3 100644 --- a/include/fiction/algorithms/physical_design/exact.hpp +++ b/include/fiction/algorithms/physical_design/exact.hpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -36,19 +35,18 @@ #include #include -#include #include #include #include #include #include #include +#include #include #include #include #include #include -#include #include #include #include @@ -940,7 +938,7 @@ class exact_impl /** * Constructs a series of expressions to evaluate how many tiles were occupied by a given edge. Therefore, all * te variables are translated to expressions of the form ite(te, 1, 0) which allows for applying z3::sum to - * them. This is a work around because no such api function for pseudo boolean exists. + * them. This is a workaround because no such api function for pseudo boolean exists. * * @param e Edge to consider. * @param ve Vector of expressions to extend. @@ -958,7 +956,7 @@ class exact_impl // an artificial latch variable counts as an extra 1 clock cycle (n clock phases) if (has_synchronization_elements_v && params.synchronization_elements && !params.desynchronize) { - ve.push_back(z3::ite(get_te(t, e), get_tse(t) * num_phases + one, zero)); + ve.push_back(z3::ite(get_te(t, e), (get_tse(t) * num_phases) + one, zero)); } else { @@ -2366,7 +2364,7 @@ class exact_impl */ void black_list_gates() // TODO take advantage of incremental solving { - const auto gather_black_list_expr = [this](const auto& port, const auto& t) noexcept + const auto gather_black_list_expr = [this](const auto& port, const auto& t) { z3::expr_vector iop{*ctx}; From f5bc1fb3ffd194ffbd065055e2212ecb9e2c72a5 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 4 Dec 2024 11:36:14 +0000 Subject: [PATCH 24/42] :memo: Update pyfiction docstrings Signed-off-by: GitHub Actions --- .../pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp b/bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp index 2f8cdd768..194480717 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp @@ -5906,8 +5906,8 @@ static const char *__doc_fiction_detail_exact_impl_smt_handler_tile_ite_counters R"doc(Constructs a series of expressions to evaluate how many tiles were occupied by a given edge. Therefore, all te variables are translated to expressions of the form ite(te, 1, 0) which allows for applying -z3::sum to them. This is a work around because no such api function -for pseudo boolean exists. +z3::sum to them. This is a workaround because no such api function for +pseudo boolean exists. Parameter ``e``: Edge to consider. From c27082f2818ab490bd5f57a4ccca2e1aad7d479e Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Wed, 4 Dec 2024 12:38:46 +0100 Subject: [PATCH 25/42] :label: Type interface for logic simulation --- .../algorithms/simulation/logic_simulation.hpp | 2 +- bindings/mnt/pyfiction/pyfiction.pyi | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/logic_simulation.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/logic_simulation.hpp index a87f06735..08adfe0e6 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/logic_simulation.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/logic_simulation.hpp @@ -5,7 +5,6 @@ #ifndef PYFICTION_LOGIC_SIMULATION_HPP #define PYFICTION_LOGIC_SIMULATION_HPP -#include "pyfiction/documentation.hpp" #include "pyfiction/types.hpp" #include @@ -16,6 +15,7 @@ #include #include +#include #include #include #include diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 632e0b906..b4c9df85d 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1,4 +1,4 @@ -from typing import overload, Union, List, Optional, Tuple +from typing import overload, Dict, Union, List, Optional, Tuple from enum import Enum @@ -1760,6 +1760,22 @@ def critical_path_length_and_throughput( int, int]: ... +## simulation + +### logic + + +@overload +def simulate(network: technology_network) -> Dict[str, List[bool]]: ... + + +@overload +def simulate(layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout]) -> Dict[ + str, List[bool]]: ... + + +### sidb + # Technology @overload From e9fa1af539f7b94421ae1003f2729d18b4ef4d55 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Wed, 4 Dec 2024 13:55:33 +0100 Subject: [PATCH 26/42] :label: Type interface for verification --- .../verification/equivalence_checking.hpp | 4 -- bindings/mnt/pyfiction/pyfiction.pyi | 52 +++++++++++++++++++ .../verification/equivalence_checking.hpp | 5 +- 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/verification/equivalence_checking.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/verification/equivalence_checking.hpp index ff47b47f1..044d71488 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/verification/equivalence_checking.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/verification/equivalence_checking.hpp @@ -72,10 +72,6 @@ inline void equivalence_checking(pybind11::module& m) DOC(fiction_equivalence_checking_stats_counter_example)) .def_readonly("runtime", &fiction::equivalence_checking_stats::runtime, DOC(fiction_equivalence_checking_stats_duration)) - .def_readonly("spec_drv_stats", &fiction::equivalence_checking_stats::spec_drv_stats, - DOC(fiction_equivalence_checking_stats_spec_drv_stats)) - .def_readonly("impl_drv_stats", &fiction::equivalence_checking_stats::impl_drv_stats, - DOC(fiction_equivalence_checking_stats_impl_drv_stats)) ; diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index b4c9df85d..91efedd6c 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1776,6 +1776,58 @@ def simulate(layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, ### sidb +## verification + +class gate_level_drv_params: + + def __init__(self) -> None: ... + + unplaced_nodes: bool + placed_dead_nodes: bool + non_adjacent_connections: bool + missing_connections: bool + crossing_gates: bool + clocked_data_flow: bool + has_io: bool + empty_io: bool + io_pins: bool + border_io: bool + + +def gate_level_drvs( + layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], + params: Optional[gate_level_drv_params] = gate_level_drv_params(), + print_report: Optional[bool] = False +) -> Tuple[int, int]: ... + + +class eq_type(Enum): + NO = ... + WEAK = ... + STRONG = ... + + +class equivalence_checking_stats: + + def __init__(self) -> None: ... + + eq: eq_type + tp_spec: int + tp_impl: int + tp_diff: int + counter_example: List[bool] + runtime: float + + +def equivalence_checking( + specification: Union[ + technology_network, cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], + implementation: Union[ + technology_network, cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], + statistics: Optional[equivalence_checking_stats] = None +) -> eq_type: ... + + # Technology @overload diff --git a/include/fiction/algorithms/verification/equivalence_checking.hpp b/include/fiction/algorithms/verification/equivalence_checking.hpp index 87eb91077..f35b74230 100644 --- a/include/fiction/algorithms/verification/equivalence_checking.hpp +++ b/include/fiction/algorithms/verification/equivalence_checking.hpp @@ -8,15 +8,14 @@ #include "fiction/algorithms/properties/critical_path_length_and_throughput.hpp" #include "fiction/algorithms/verification/design_rule_violations.hpp" #include "fiction/traits.hpp" -#include "fiction/utils/name_utils.hpp" -#include #include #include #include #include #include +#include #include #include #include @@ -27,7 +26,7 @@ namespace fiction /** * The different equivalence types possible. */ -enum class eq_type +enum class eq_type : uint8_t { /** * `Spec` and `Impl` are logically not equivalent OR `Impl` has DRVs. From 7f6b76753f2814bd07550b98f0855bec6a6e3f0f Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Wed, 4 Dec 2024 14:16:57 +0100 Subject: [PATCH 27/42] :label: Type interface for most I/O functionality --- .../pyfiction/inout/read_fgl_layout.hpp | 1 - .../pyfiction/inout/write_fgl_layout.hpp | 1 - .../pyfiction/inout/write_svg_layout.hpp | 2 +- bindings/mnt/pyfiction/pyfiction.pyi | 106 ++++++++++++++++++ 4 files changed, 107 insertions(+), 3 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/inout/read_fgl_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/inout/read_fgl_layout.hpp index 65d445cca..1bb7dfb66 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/inout/read_fgl_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/inout/read_fgl_layout.hpp @@ -9,7 +9,6 @@ #include "pyfiction/types.hpp" #include -#include #include diff --git a/bindings/mnt/pyfiction/include/pyfiction/inout/write_fgl_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/inout/write_fgl_layout.hpp index 4ef815b69..dc681dfd9 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/inout/write_fgl_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/inout/write_fgl_layout.hpp @@ -9,7 +9,6 @@ #include "pyfiction/types.hpp" #include -#include #include diff --git a/bindings/mnt/pyfiction/include/pyfiction/inout/write_svg_layout.hpp b/bindings/mnt/pyfiction/include/pyfiction/inout/write_svg_layout.hpp index 9ee910865..f54f60b86 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/inout/write_svg_layout.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/inout/write_svg_layout.hpp @@ -61,7 +61,7 @@ inline void write_qca_layout_svg_impl(pybind11::module& m) } // namespace detail -void write_svg_layout(pybind11::module& m) +inline void write_svg_layout(pybind11::module& m) { namespace py = pybind11; diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 91efedd6c..176cc6f93 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1760,6 +1760,8 @@ def critical_path_length_and_throughput( int, int]: ... +# TODO design_sidb_gates, gold, hexagonalization, PLO, wiring reduction + ## simulation ### logic @@ -1776,6 +1778,8 @@ def simulate(layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, ### sidb +# TODO all SiDB simulation + ## verification class gate_level_drv_params: @@ -1828,6 +1832,102 @@ def equivalence_checking( ) -> eq_type: ... +# In/Out + +class fgl_parsing_error(RuntimeError): ... + + +def read_cartesian_fgl_layout(filename: str, layout_name: str = "") -> cartesian_gate_layout: ... + + +def read_shifted_cartesian_fgl_layout(filename: str, layout_name: str = "") -> shifted_cartesian_gate_layout: ... + + +def read_hexagonal_fgl_layout(filename: str, layout_name: str = "") -> hexagonal_gate_layout: ... + + +class unsupported_character_exception(Exception): ... + + +class undefined_cell_label_exception(Exception): ... + + +class unrecognized_cell_definition_exception(Exception): ... + + +def read_fqca_layout(filename: str, layout_name: str = "") -> qca_layout: ... + + +# TODO read_sqd_layout + +def write_dot_network(network: technology_network, filename: str) -> None: ... + + +def write_dot_layout(layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], + filename: str) -> None: ... + + +def write_fgl_layout(layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], + filename: str) -> None: ... + + +class out_of_cell_names_exception(IndexError): ... + + +class write_fqca_layout_params: + def __init__(self) -> None: ... + + create_inter_layer_via_cells: bool + + +def write_fqca_layout( + layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], + filename: str, + params: Optional[write_fqca_layout_params] = write_fqca_layout_params() +) -> None: ... + + +# TODO write_operational_domain + +class write_qca_layout_params: + + def __init__(self) -> None: ... + + create_inter_layer_via_cells: bool + + +def write_qca_layout( + layout: qca_layout, + filename: str, + params: Optional[write_qca_layout_params] = write_qca_layout_params() +) -> None: ... + + +def write_qcc_layout( + layout: inml_layout, + filename: str +) -> None: ... + + +def write_qll_layout( + layout: Union[qca_layout, inml_layout], + filename: str +) -> None: ... + + +def write_sqd_layout( + # layout: Union[sidb_111_lattice, sidb_100_lattice, sidb_layout], # TODO move to this layout spec as soon as lattices are added + layout: sidb_layout, + filename: str +) -> None: ... + + +def write_sqd_sim_result( + layout: sidb_layout, + filename: str +) -> None: ... + + # Technology @overload @@ -1841,3 +1941,9 @@ def area(layout: inml_layout, width: int = 50, height: int = 100, hspace: int = @overload def area(layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, vspace: float = 0.384) -> float: ... + +# TODO all SiDB technology + +# Utils + +# TODO all utils From d4e2aead9a0684d3296098b6aac5c65fe4b1eed3 Mon Sep 17 00:00:00 2001 From: Drewniok Date: Wed, 4 Dec 2024 18:15:53 +0100 Subject: [PATCH 28/42] :art: first test. --- bindings/mnt/pyfiction/pyfiction.pyi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 176cc6f93..9262fadd3 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1944,6 +1944,31 @@ def area(layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: f # TODO all SiDB technology +class sidb_simulation_parameters: + + epsilon_r: float + lambda_tf: float + mu_minus: float + base: int + + def __init__( + self, + base_number: int = 3, + mu_minus: float = -0.32, + relative_permittivity: float = 5.6, + screening_distance: float = 5.0 + ) -> None: + ... + + @overload + def __init__(self) -> None: ... + + def k(self) -> float: + ... + + def mu_plus(self) -> float: + ... + # Utils # TODO all utils From ac2039e51ce6777321d167e7331370812d83b5a1 Mon Sep 17 00:00:00 2001 From: Drewniok Date: Wed, 4 Dec 2024 18:16:10 +0100 Subject: [PATCH 29/42] :art: first test. --- bindings/mnt/pyfiction/pyfiction.pyi | 3 --- 1 file changed, 3 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 9262fadd3..3a78ba21f 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1960,9 +1960,6 @@ class sidb_simulation_parameters: ) -> None: ... - @overload - def __init__(self) -> None: ... - def k(self) -> float: ... From d38011ddeedbaf726c6a2d20617b44d06484abfc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:21:02 +0000 Subject: [PATCH 30/42] =?UTF-8?q?=F0=9F=8E=A8=20Incorporated=20pre-commit?= =?UTF-8?q?=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bindings/mnt/pyfiction/pyfiction.pyi | 1411 ++++------------- .../test/layouts/test_coordinates.py | 3 +- 2 files changed, 311 insertions(+), 1103 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 3a78ba21f..526cf22e6 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1,22 +1,17 @@ -from typing import overload, Dict, Union, List, Optional, Tuple from enum import Enum - +from typing import overload # Layouts class offset_coordinate: @overload def __init__(self) -> None: ... - @overload def __init__(self, int_repr: int) -> None: ... - @overload def __init__(self, x: int, y: int, z: int) -> None: ... - @overload def __init__(self, c: offset_coordinate) -> None: ... - @overload def __init__(self, c: tuple[int, int, int]) -> None: ... @@ -25,32 +20,20 @@ class offset_coordinate: z: int def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - def __lt__(self, other: offset_coordinate) -> bool: ... - def __gt__(self, other: offset_coordinate) -> bool: ... - def __le__(self, other: offset_coordinate) -> bool: ... - def __ge__(self, other: offset_coordinate) -> bool: ... - - def __repr__(self) -> str: ... - def __hash__(self) -> int: ... - class cube_coordinate: @overload def __init__(self) -> None: ... - @overload def __init__(self, x: int, y: int, z: int = 0) -> None: ... - @overload def __init__(self, c: cube_coordinate) -> None: ... - @overload def __init__(self, c: tuple[int, int, int]) -> None: ... @@ -59,32 +42,20 @@ class cube_coordinate: z: int def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - def __lt__(self, other: cube_coordinate) -> bool: ... - def __gt__(self, other: cube_coordinate) -> bool: ... - def __le__(self, other: cube_coordinate) -> bool: ... - def __ge__(self, other: cube_coordinate) -> bool: ... - - def __repr__(self) -> str: ... - def __hash__(self) -> int: ... - class siqad_coordinate: @overload def __init__(self) -> None: ... - @overload def __init__(self, x: int, y: int, z: int = 0) -> None: ... - @overload def __init__(self, c: siqad_coordinate) -> None: ... - @overload def __init__(self, c: tuple[int, int, int]) -> None: ... @@ -93,1021 +64,535 @@ class siqad_coordinate: z: int def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - def __lt__(self, other: siqad_coordinate) -> bool: ... - def __gt__(self, other: siqad_coordinate) -> bool: ... - def __le__(self, other: siqad_coordinate) -> bool: ... - def __ge__(self, other: siqad_coordinate) -> bool: ... - - def __repr__(self) -> str: ... - def __hash__(self) -> int: ... - # For consistent behavior: -def area(coord: Union[offset_coordinate, cube_coordinate, siqad_coordinate]) -> float: ... - - -def volume(coord: Union[offset_coordinate, cube_coordinate, siqad_coordinate]) -> float: ... - +def area(coord: offset_coordinate | cube_coordinate | siqad_coordinate) -> float: ... +def volume(coord: offset_coordinate | cube_coordinate | siqad_coordinate) -> float: ... # For conversions with potentially nuanced behavior: @overload def to_offset_coord(coord: siqad_coordinate) -> offset_coordinate: ... - - @overload def to_cube_coord(coord: siqad_coordinate) -> cube_coordinate: ... - - @overload def to_siqad_coord(coord: offset_coordinate) -> siqad_coordinate: ... - - @overload def to_siqad_coord(coord: cube_coordinate) -> siqad_coordinate: ... - class cartesian_layout: @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: offset_coordinate) -> None: ... - def coord(self, x: int, y: int, z: int = 0) -> offset_coordinate: ... - def x(self) -> int: ... - def y(self) -> int: ... - def z(self) -> int: ... - def area(self) -> int: ... - def resize(self, dimension: offset_coordinate) -> None: ... - - def north(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def north_east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def south_east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def south(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def south_west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def north_west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def above(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def below(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - + def north(self, c: offset_coordinate) -> offset_coordinate | None: ... + def north_east(self, c: offset_coordinate) -> offset_coordinate | None: ... + def east(self, c: offset_coordinate) -> offset_coordinate | None: ... + def south_east(self, c: offset_coordinate) -> offset_coordinate | None: ... + def south(self, c: offset_coordinate) -> offset_coordinate | None: ... + def south_west(self, c: offset_coordinate) -> offset_coordinate | None: ... + def west(self, c: offset_coordinate) -> offset_coordinate | None: ... + def north_west(self, c: offset_coordinate) -> offset_coordinate | None: ... + def above(self, c: offset_coordinate) -> offset_coordinate | None: ... + def below(self, c: offset_coordinate) -> offset_coordinate | None: ... def is_north_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_east_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_south_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_west_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_adjacent_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_adjacent_elevation_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_above(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_below(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_northwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_eastwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_southwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_westwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_at_northern_border(self, c: offset_coordinate) -> bool: ... - def is_at_eastern_border(self, c: offset_coordinate) -> bool: ... - def is_at_southern_border(self, c: offset_coordinate) -> bool: ... - def is_at_western_border(self, c: offset_coordinate) -> bool: ... - def is_at_any_border(self, c: offset_coordinate) -> bool: ... - - def northern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def eastern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def southern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def western_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - + def northern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... + def eastern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... + def southern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... + def western_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... def is_ground_layer(self, c: offset_coordinate) -> bool: ... - def is_crossing_layer(self, c: offset_coordinate) -> bool: ... - def is_within_bounds(self, c: offset_coordinate) -> bool: ... - - def offset_coordinates(self) -> List[offset_coordinate]: ... - - def ground_coordinates(self) -> List[offset_coordinate]: ... - - def adjacent_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... - - def adjacent_opposite_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... - - def __repr__(self) -> str: ... - + def offset_coordinates(self) -> list[offset_coordinate]: ... + def ground_coordinates(self) -> list[offset_coordinate]: ... + def adjacent_coordinates(self, c: offset_coordinate) -> list[offset_coordinate]: ... + def adjacent_opposite_coordinates(self, c: offset_coordinate) -> list[offset_coordinate]: ... class shifted_cartesian_layout: @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: offset_coordinate) -> None: ... - def coord(self, x: int, y: int, z: int = 0) -> offset_coordinate: ... - def x(self) -> int: ... - def y(self) -> int: ... - def z(self) -> int: ... - def area(self) -> int: ... - def resize(self, dimension: offset_coordinate) -> None: ... - - def north(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def north_east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def south_east(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def south(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def south_west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def north_west(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def above(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def below(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - + def north(self, c: offset_coordinate) -> offset_coordinate | None: ... + def north_east(self, c: offset_coordinate) -> offset_coordinate | None: ... + def east(self, c: offset_coordinate) -> offset_coordinate | None: ... + def south_east(self, c: offset_coordinate) -> offset_coordinate | None: ... + def south(self, c: offset_coordinate) -> offset_coordinate | None: ... + def south_west(self, c: offset_coordinate) -> offset_coordinate | None: ... + def west(self, c: offset_coordinate) -> offset_coordinate | None: ... + def north_west(self, c: offset_coordinate) -> offset_coordinate | None: ... + def above(self, c: offset_coordinate) -> offset_coordinate | None: ... + def below(self, c: offset_coordinate) -> offset_coordinate | None: ... def is_north_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_east_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_south_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_west_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_adjacent_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_adjacent_elevation_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_above(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_below(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_northwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_eastwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_southwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_westwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_at_northern_border(self, c: offset_coordinate) -> bool: ... - def is_at_eastern_border(self, c: offset_coordinate) -> bool: ... - def is_at_southern_border(self, c: offset_coordinate) -> bool: ... - def is_at_western_border(self, c: offset_coordinate) -> bool: ... - def is_at_any_border(self, c: offset_coordinate) -> bool: ... - - def northern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def eastern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def southern_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - - def western_border_of(self, c: offset_coordinate) -> Optional[offset_coordinate]: ... - + def northern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... + def eastern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... + def southern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... + def western_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... def is_ground_layer(self, c: offset_coordinate) -> bool: ... - def is_crossing_layer(self, c: offset_coordinate) -> bool: ... - def is_within_bounds(self, c: offset_coordinate) -> bool: ... - - def offset_coordinates(self) -> List[offset_coordinate]: ... - - def ground_coordinates(self) -> List[offset_coordinate]: ... - - def adjacent_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... - - def adjacent_opposite_coordinates(self, c: offset_coordinate) -> List[offset_coordinate]: ... - - def __repr__(self) -> str: ... - + def offset_coordinates(self) -> list[offset_coordinate]: ... + def ground_coordinates(self) -> list[offset_coordinate]: ... + def adjacent_coordinates(self, c: offset_coordinate) -> list[offset_coordinate]: ... + def adjacent_opposite_coordinates(self, c: offset_coordinate) -> list[offset_coordinate]: ... class hexagonal_layout: @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: cube_coordinate) -> None: ... - def coord(self, x: int, y: int, z: int = 0) -> cube_coordinate: ... - def x(self) -> int: ... - def y(self) -> int: ... - def z(self) -> int: ... - def area(self) -> int: ... - def resize(self, dimension: cube_coordinate) -> None: ... - - def north(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def north_east(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def east(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def south_east(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def south(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def south_west(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def west(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def north_west(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def above(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def below(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - + def north(self, c: cube_coordinate) -> cube_coordinate | None: ... + def north_east(self, c: cube_coordinate) -> cube_coordinate | None: ... + def east(self, c: cube_coordinate) -> cube_coordinate | None: ... + def south_east(self, c: cube_coordinate) -> cube_coordinate | None: ... + def south(self, c: cube_coordinate) -> cube_coordinate | None: ... + def south_west(self, c: cube_coordinate) -> cube_coordinate | None: ... + def west(self, c: cube_coordinate) -> cube_coordinate | None: ... + def north_west(self, c: cube_coordinate) -> cube_coordinate | None: ... + def above(self, c: cube_coordinate) -> cube_coordinate | None: ... + def below(self, c: cube_coordinate) -> cube_coordinate | None: ... def is_north_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_east_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_south_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_west_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_adjacent_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_adjacent_elevation_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_above(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_below(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_northwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_eastwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_southwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_westwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_at_northern_border(self, c: cube_coordinate) -> bool: ... - def is_at_eastern_border(self, c: cube_coordinate) -> bool: ... - def is_at_southern_border(self, c: cube_coordinate) -> bool: ... - def is_at_western_border(self, c: cube_coordinate) -> bool: ... - def is_at_any_border(self, c: cube_coordinate) -> bool: ... - - def northern_border_of(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def eastern_border_of(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def southern_border_of(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - - def western_border_of(self, c: cube_coordinate) -> Optional[cube_coordinate]: ... - + def northern_border_of(self, c: cube_coordinate) -> cube_coordinate | None: ... + def eastern_border_of(self, c: cube_coordinate) -> cube_coordinate | None: ... + def southern_border_of(self, c: cube_coordinate) -> cube_coordinate | None: ... + def western_border_of(self, c: cube_coordinate) -> cube_coordinate | None: ... def is_ground_layer(self, c: cube_coordinate) -> bool: ... - def is_crossing_layer(self, c: cube_coordinate) -> bool: ... - def is_within_bounds(self, c: cube_coordinate) -> bool: ... - - def coordinates(self) -> List[cube_coordinate]: ... - - def ground_coordinates(self) -> List[cube_coordinate]: ... - - def adjacent_coordinates(self, c: cube_coordinate) -> List[cube_coordinate]: ... - - def adjacent_opposite_coordinates(self, c: cube_coordinate) -> List[cube_coordinate]: ... - - def __repr__(self) -> str: ... - + def coordinates(self) -> list[cube_coordinate]: ... + def ground_coordinates(self) -> list[cube_coordinate]: ... + def adjacent_coordinates(self, c: cube_coordinate) -> list[cube_coordinate]: ... + def adjacent_opposite_coordinates(self, c: cube_coordinate) -> list[cube_coordinate]: ... class clocked_cartesian_layout(cartesian_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: offset_coordinate) -> None: ... - @overload def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave") -> None: ... - def assign_clock_number(self, cz: offset_coordinate, cn: int) -> None: ... - def get_clock_number(self, cz: offset_coordinate) -> int: ... - def num_clocks(self) -> int: ... - def is_regularly_clocked(self) -> bool: ... - def is_clocking_scheme(self, name: str) -> bool: ... - def is_incoming_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... - def is_outgoing_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... - - def incoming_clocked_zones(self, cz: offset_coordinate) -> List[offset_coordinate]: ... - - def outgoing_clocked_zones(self, cz: offset_coordinate) -> List[offset_coordinate]: ... - + def incoming_clocked_zones(self, cz: offset_coordinate) -> list[offset_coordinate]: ... + def outgoing_clocked_zones(self, cz: offset_coordinate) -> list[offset_coordinate]: ... def in_degree(self, cz: offset_coordinate) -> int: ... - def out_degree(self, cz: offset_coordinate) -> int: ... - def degree(self, cz: offset_coordinate) -> int: ... - def __repr__(self) -> str: ... - - class clocked_shifted_cartesian_layout(shifted_cartesian_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: offset_coordinate) -> None: ... - @overload def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave") -> None: ... - def assign_clock_number(self, cz: offset_coordinate, cn: int) -> None: ... - def get_clock_number(self, cz: offset_coordinate) -> int: ... - def num_clocks(self) -> int: ... - def is_regularly_clocked(self) -> bool: ... - def is_clocking_scheme(self, name: str) -> bool: ... - def is_incoming_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... - def is_outgoing_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... - - def incoming_clocked_zones(self, cz: offset_coordinate) -> List[offset_coordinate]: ... - - def outgoing_clocked_zones(self, cz: offset_coordinate) -> List[offset_coordinate]: ... - + def incoming_clocked_zones(self, cz: offset_coordinate) -> list[offset_coordinate]: ... + def outgoing_clocked_zones(self, cz: offset_coordinate) -> list[offset_coordinate]: ... def in_degree(self, cz: offset_coordinate) -> int: ... - def out_degree(self, cz: offset_coordinate) -> int: ... - def degree(self, cz: offset_coordinate) -> int: ... - def __repr__(self) -> str: ... - - class clocked_hexagonal_layout(hexagonal_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: cube_coordinate) -> None: ... - @overload def __init__(self, dimension: cube_coordinate, clocking_scheme: str = "2DDWave") -> None: ... - def assign_clock_number(self, cz: cube_coordinate, cn: int) -> None: ... - def get_clock_number(self, cz: cube_coordinate) -> int: ... - def num_clocks(self) -> int: ... - def is_regularly_clocked(self) -> bool: ... - def is_clocking_scheme(self, name: str) -> bool: ... - def is_incoming_clocked(self, cz1: cube_coordinate, cz2: cube_coordinate) -> bool: ... - def is_outgoing_clocked(self, cz1: cube_coordinate, cz2: cube_coordinate) -> bool: ... - - def incoming_clocked_zones(self, cz: cube_coordinate) -> List[cube_coordinate]: ... - - def outgoing_clocked_zones(self, cz: cube_coordinate) -> List[cube_coordinate]: ... - + def incoming_clocked_zones(self, cz: cube_coordinate) -> list[cube_coordinate]: ... + def outgoing_clocked_zones(self, cz: cube_coordinate) -> list[cube_coordinate]: ... def in_degree(self, cz: cube_coordinate) -> int: ... - def out_degree(self, cz: cube_coordinate) -> int: ... - def degree(self, cz: cube_coordinate) -> int: ... - def __repr__(self) -> str: ... - - class cartesian_gate_layout(clocked_cartesian_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: offset_coordinate) -> None: ... - @overload - def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", - layout_name: str = "") -> None: ... - - def create_pi(self, name: str = "", t: Optional[offset_coordinate] = None) -> None: ... - - def create_po(self, s: int, name: str = "", t: Optional[offset_coordinate] = None) -> None: ... - + def __init__( + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + ) -> None: ... + def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... + def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... def is_pi(self, n: int) -> bool: ... - def is_po(self, n: int) -> bool: ... - def is_pi_coordinate(self, t: offset_coordinate) -> bool: ... - def is_po_coordinate(self, t: offset_coordinate) -> bool: ... - def is_inv(self) -> bool: ... - def is_and(self) -> bool: ... - def is_nand(self) -> bool: ... - def is_or(self) -> bool: ... - def is_nor(self) -> bool: ... - def is_xor(self) -> bool: ... - def is_xnor(self) -> bool: ... - def is_maj(self) -> bool: ... - def is_fanout(self) -> bool: ... - def is_wire(self) -> bool: ... - def set_layout_name(self, name: str) -> None: ... - def get_layout_name(self) -> str: ... - def set_input_name(self, index: int, name: str) -> None: ... - def get_input_name(self, index: int) -> str: ... - def set_output_name(self, index: int, name: str) -> None: ... - def get_output_name(self, index: int) -> str: ... - def get_name(self, s: int) -> str: ... - - def create_buf(self, a: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_not(self, a: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_and(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_nand(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_or(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_nor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_xor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_xnor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_maj(self, a: int, b: int, c: int, t: Optional[offset_coordinate] = None) -> None: ... - + def create_buf(self, a: int, t: offset_coordinate | None = None) -> None: ... + def create_not(self, a: int, t: offset_coordinate | None = None) -> None: ... + def create_and(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_nand(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_or(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_nor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_xor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_xnor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_maj(self, a: int, b: int, c: int, t: offset_coordinate | None = None) -> None: ... def num_pis(self) -> int: ... - def num_pos(self) -> int: ... - def num_gates(self) -> int: ... - def num_wires(self) -> int: ... - def num_crossings(self) -> int: ... - def is_empty(self) -> bool: ... - def fanin_size(self, n: int) -> int: ... - def fanout_size(self, n: int) -> int: ... - def get_int(self, t: offset_coordinate) -> int: ... - def get_coordinate(self, n: int) -> offset_coordinate: ... - def make_int(self, n: int) -> int: ... - - def move_int(self, n: int, t: offset_coordinate, new_children: List[offset_coordinate] = []) -> None: ... - + def move_int(self, n: int, t: offset_coordinate, new_children: list[offset_coordinate] = []) -> None: ... def clear_coordinate(self, t: offset_coordinate) -> None: ... - def is_gate_coordinate(self, t: offset_coordinate) -> bool: ... - def is_wire_coordinate(self, t: offset_coordinate) -> bool: ... - def is_empty_coordinate(self, t: offset_coordinate) -> bool: ... - - def pis(self) -> List[offset_coordinate]: ... - - def pos(self) -> List[offset_coordinate]: ... - - def gates(self) -> List[offset_coordinate]: ... - - def wires(self) -> List[offset_coordinate]: ... - - def fanins(self, t: offset_coordinate) -> List[int]: ... - - def fanouts(self, t: offset_coordinate) -> List[int]: ... - + def pis(self) -> list[offset_coordinate]: ... + def pos(self) -> list[offset_coordinate]: ... + def gates(self) -> list[offset_coordinate]: ... + def wires(self) -> list[offset_coordinate]: ... + def fanins(self, t: offset_coordinate) -> list[int]: ... + def fanouts(self, t: offset_coordinate) -> list[int]: ... def is_incoming_int(self, t: offset_coordinate, s: int) -> bool: ... - def has_no_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_northern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_north_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_south_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_southern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_south_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_north_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def is_outgoing_int(self, t: offset_coordinate, s: int) -> bool: ... - def has_no_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_northern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_north_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_south_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_southern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_south_western_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_western_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_north_western_outgoing_int(self, t: offset_coordinate) -> bool: ... - - def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... - + def bounding_box_2d(self) -> tuple[offset_coordinate, offset_coordinate]: ... def is_dead(self, n: int) -> bool: ... - def __repr__(self) -> str: ... - - class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: offset_coordinate) -> None: ... - @overload - def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", - layout_name: str = "") -> None: ... - - def create_pi(self, name: str = "", t: Optional[offset_coordinate] = None) -> None: ... - - def create_po(self, s: int, name: str = "", t: Optional[offset_coordinate] = None) -> None: ... - + def __init__( + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + ) -> None: ... + def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... + def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... def is_pi(self, n: int) -> bool: ... - def is_po(self, n: int) -> bool: ... - def is_pi_coordinate(self, t: offset_coordinate) -> bool: ... - def is_po_coordinate(self, t: offset_coordinate) -> bool: ... - def is_inv(self) -> bool: ... - def is_and(self) -> bool: ... - def is_nand(self) -> bool: ... - def is_or(self) -> bool: ... - def is_nor(self) -> bool: ... - def is_xor(self) -> bool: ... - def is_xnor(self) -> bool: ... - def is_maj(self) -> bool: ... - def is_fanout(self) -> bool: ... - def is_wire(self) -> bool: ... - def set_layout_name(self, name: str) -> None: ... - def get_layout_name(self) -> str: ... - def set_input_name(self, index: int, name: str) -> None: ... - def get_input_name(self, index: int) -> str: ... - def set_output_name(self, index: int, name: str) -> None: ... - def get_output_name(self, index: int) -> str: ... - def get_name(self, s: int) -> str: ... - - def create_buf(self, a: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_not(self, a: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_and(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_nand(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_or(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_nor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_xor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_xnor(self, a: int, b: int, t: Optional[offset_coordinate] = None) -> None: ... - - def create_maj(self, a: int, b: int, c: int, t: Optional[offset_coordinate] = None) -> None: ... - + def create_buf(self, a: int, t: offset_coordinate | None = None) -> None: ... + def create_not(self, a: int, t: offset_coordinate | None = None) -> None: ... + def create_and(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_nand(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_or(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_nor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_xor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_xnor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... + def create_maj(self, a: int, b: int, c: int, t: offset_coordinate | None = None) -> None: ... def num_pis(self) -> int: ... - def num_pos(self) -> int: ... - def num_gates(self) -> int: ... - def num_wires(self) -> int: ... - def num_crossings(self) -> int: ... - def is_empty(self) -> bool: ... - def fanin_size(self, n: int) -> int: ... - def fanout_size(self, n: int) -> int: ... - def get_int(self, t: offset_coordinate) -> int: ... - def get_coordinate(self, n: int) -> offset_coordinate: ... - def make_int(self, n: int) -> int: ... - - def move_int(self, n: int, t: offset_coordinate, new_children: List[offset_coordinate] = []) -> None: ... - + def move_int(self, n: int, t: offset_coordinate, new_children: list[offset_coordinate] = []) -> None: ... def clear_coordinate(self, t: offset_coordinate) -> None: ... - def is_gate_coordinate(self, t: offset_coordinate) -> bool: ... - def is_wire_coordinate(self, t: offset_coordinate) -> bool: ... - def is_empty_coordinate(self, t: offset_coordinate) -> bool: ... - - def pis(self) -> List[offset_coordinate]: ... - - def pos(self) -> List[offset_coordinate]: ... - - def gates(self) -> List[offset_coordinate]: ... - - def wires(self) -> List[offset_coordinate]: ... - - def fanins(self, t: offset_coordinate) -> List[int]: ... - - def fanouts(self, t: offset_coordinate) -> List[int]: ... - + def pis(self) -> list[offset_coordinate]: ... + def pos(self) -> list[offset_coordinate]: ... + def gates(self) -> list[offset_coordinate]: ... + def wires(self) -> list[offset_coordinate]: ... + def fanins(self, t: offset_coordinate) -> list[int]: ... + def fanouts(self, t: offset_coordinate) -> list[int]: ... def is_incoming_int(self, t: offset_coordinate, s: int) -> bool: ... - def has_no_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_northern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_north_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_south_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_southern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_south_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_north_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def is_outgoing_int(self, t: offset_coordinate, s: int) -> bool: ... - def has_no_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_northern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_north_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_south_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_southern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_south_western_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_western_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_north_western_outgoing_int(self, t: offset_coordinate) -> bool: ... - - def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... - + def bounding_box_2d(self) -> tuple[offset_coordinate, offset_coordinate]: ... def is_dead(self, n: int) -> bool: ... - def __repr__(self) -> str: ... - - class hexagonal_gate_layout(clocked_hexagonal_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: cube_coordinate) -> None: ... - @overload - def __init__(self, dimension: cube_coordinate, clocking_scheme: str = "2DDWave", - layout_name: str = "") -> None: ... - - def create_pi(self, name: str = "", t: Optional[cube_coordinate] = None) -> None: ... - - def create_po(self, s: int, name: str = "", t: Optional[cube_coordinate] = None) -> None: ... - + def __init__(self, dimension: cube_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "") -> None: ... + def create_pi(self, name: str = "", t: cube_coordinate | None = None) -> None: ... + def create_po(self, s: int, name: str = "", t: cube_coordinate | None = None) -> None: ... def is_pi(self, n: int) -> bool: ... - def is_po(self, n: int) -> bool: ... - def is_pi_coordinate(self, t: cube_coordinate) -> bool: ... - def is_po_coordinate(self, t: cube_coordinate) -> bool: ... - def is_inv(self) -> bool: ... - def is_and(self) -> bool: ... - def is_nand(self) -> bool: ... - def is_or(self) -> bool: ... - def is_nor(self) -> bool: ... - def is_xor(self) -> bool: ... - def is_xnor(self) -> bool: ... - def is_maj(self) -> bool: ... - def is_fanout(self) -> bool: ... - def is_wire(self) -> bool: ... - def set_layout_name(self, name: str) -> None: ... - def get_layout_name(self) -> str: ... - def set_input_name(self, index: int, name: str) -> None: ... - def get_input_name(self, index: int) -> str: ... - def set_output_name(self, index: int, name: str) -> None: ... - def get_output_name(self, index: int) -> str: ... - def get_name(self, s: int) -> str: ... - - def create_buf(self, a: int, t: Optional[cube_coordinate] = None) -> None: ... - - def create_not(self, a: int, t: Optional[cube_coordinate] = None) -> None: ... - - def create_and(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... - - def create_nand(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... - - def create_or(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... - - def create_nor(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... - - def create_xor(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... - - def create_xnor(self, a: int, b: int, t: Optional[cube_coordinate] = None) -> None: ... - - def create_maj(self, a: int, b: int, c: int, t: Optional[cube_coordinate] = None) -> None: ... - + def create_buf(self, a: int, t: cube_coordinate | None = None) -> None: ... + def create_not(self, a: int, t: cube_coordinate | None = None) -> None: ... + def create_and(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... + def create_nand(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... + def create_or(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... + def create_nor(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... + def create_xor(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... + def create_xnor(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... + def create_maj(self, a: int, b: int, c: int, t: cube_coordinate | None = None) -> None: ... def num_pis(self) -> int: ... - def num_pos(self) -> int: ... - def num_gates(self) -> int: ... - def num_wires(self) -> int: ... - def num_crossings(self) -> int: ... - def is_empty(self) -> bool: ... - def fanin_size(self, n: int) -> int: ... - def fanout_size(self, n: int) -> int: ... - def get_int(self, t: cube_coordinate) -> int: ... - def get_coordinate(self, n: int) -> cube_coordinate: ... - def make_int(self, n: int) -> int: ... - - def move_int(self, n: int, t: cube_coordinate, new_children: List[cube_coordinate] = []) -> None: ... - + def move_int(self, n: int, t: cube_coordinate, new_children: list[cube_coordinate] = []) -> None: ... def clear_coordinate(self, t: cube_coordinate) -> None: ... - def is_gate_coordinate(self, t: cube_coordinate) -> bool: ... - def is_wire_coordinate(self, t: cube_coordinate) -> bool: ... - def is_empty_coordinate(self, t: cube_coordinate) -> bool: ... - - def pis(self) -> List[cube_coordinate]: ... - - def pos(self) -> List[cube_coordinate]: ... - - def gates(self) -> List[cube_coordinate]: ... - - def wires(self) -> List[cube_coordinate]: ... - - def fanins(self, t: cube_coordinate) -> List[int]: ... - - def fanouts(self, t: cube_coordinate) -> List[int]: ... - + def pis(self) -> list[cube_coordinate]: ... + def pos(self) -> list[cube_coordinate]: ... + def gates(self) -> list[cube_coordinate]: ... + def wires(self) -> list[cube_coordinate]: ... + def fanins(self, t: cube_coordinate) -> list[int]: ... + def fanouts(self, t: cube_coordinate) -> list[int]: ... def is_incoming_int(self, t: cube_coordinate, s: int) -> bool: ... - def has_no_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_northern_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_north_eastern_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_eastern_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_south_eastern_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_southern_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_south_western_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_western_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_north_western_incoming_int(self, t: cube_coordinate) -> bool: ... - def is_outgoing_int(self, t: cube_coordinate, s: int) -> bool: ... - def has_no_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_northern_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_north_eastern_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_eastern_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_south_eastern_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_southern_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_south_western_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_western_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_north_western_outgoing_int(self, t: cube_coordinate) -> bool: ... - - def bounding_box_2d(self) -> Tuple[cube_coordinate, cube_coordinate]: ... - + def bounding_box_2d(self) -> tuple[cube_coordinate, cube_coordinate]: ... def is_dead(self, n: int) -> bool: ... - def __repr__(self) -> str: ... - - class cartesian_obstruction_layout(cartesian_gate_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, layout: cartesian_gate_layout) -> None: ... - def obstruct_coordinate(self, c: offset_coordinate) -> None: ... - def obstruct_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... - def is_obstructed_coordinate(self, c: offset_coordinate) -> bool: ... - def is_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> bool: ... - def clear_obstructed_coordinate(self, c: offset_coordinate) -> None: ... - def clear_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... - def clear_obstructed_coordinates(self) -> None: ... - def clear_obstructed_connections(self) -> None: ... - class shifted_cartesian_obstruction_layout(shifted_cartesian_gate_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, layout: shifted_cartesian_gate_layout) -> None: ... - def obstruct_coordinate(self, c: offset_coordinate) -> None: ... - def obstruct_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... - def is_obstructed_coordinate(self, c: offset_coordinate) -> bool: ... - def is_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> bool: ... - def clear_obstructed_coordinate(self, c: offset_coordinate) -> None: ... - def clear_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... - def clear_obstructed_coordinates(self) -> None: ... - def clear_obstructed_connections(self) -> None: ... - class hexagonal_obstruction_layout(hexagonal_gate_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, layout: hexagonal_gate_layout) -> None: ... - def obstruct_coordinate(self, c: cube_coordinate) -> None: ... - def obstruct_connection(self, src: cube_coordinate, tgt: cube_coordinate) -> None: ... - def is_obstructed_coordinate(self, c: cube_coordinate) -> bool: ... - def is_obstructed_connection(self, src: cube_coordinate, tgt: cube_coordinate) -> bool: ... - def clear_obstructed_coordinate(self, c: cube_coordinate) -> None: ... - def clear_obstructed_connection(self, src: cube_coordinate, tgt: cube_coordinate) -> None: ... - def clear_obstructed_coordinates(self) -> None: ... - def clear_obstructed_connections(self) -> None: ... - class qca_technology: class cell_type(Enum): EMPTY = ... @@ -1117,7 +602,6 @@ class qca_technology: CONST_0 = ... CONST_1 = ... - class inml_technology: class cell_type(Enum): EMPTY = ... @@ -1130,7 +614,6 @@ class inml_technology: CROSSWIRE_MAGNET = ... FANOUT_COUPLER_MAGNET = ... - class sidb_technology: class cell_type(Enum): EMPTY = ... @@ -1139,496 +622,316 @@ class sidb_technology: OUTPUT = ... LOGIC = ... - class qca_layout(clocked_cartesian_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: offset_coordinate) -> None: ... - @overload - def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", - layout_name: str = "") -> None: ... - + def __init__( + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: qca_technology.cell_type) -> None: ... - def get_cell_type(self, c: offset_coordinate) -> qca_technology.cell_type: ... - def is_empty_cell(self, c: offset_coordinate) -> bool: ... - def assign_cell_name(self, c: offset_coordinate, n: str) -> None: ... - - def get_cell_name(self, c: offset_coordinate) -> Optional[str]: ... - + def get_cell_name(self, c: offset_coordinate) -> str | None: ... def set_layout_name(self, name: str) -> None: ... - def get_layout_name(self) -> str: ... - def num_cells(self) -> int: ... - def is_empty(self) -> bool: ... - def num_pis(self) -> int: ... - def num_pos(self) -> int: ... - def is_pi(self, c: offset_coordinate) -> bool: ... - def is_po(self, c: offset_coordinate) -> bool: ... - - def cells(self) -> List[offset_coordinate]: ... - - def pis(self) -> List[offset_coordinate]: ... - - def pos(self) -> List[offset_coordinate]: ... - - def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... - - def __repr__(self) -> str: ... - + def cells(self) -> list[offset_coordinate]: ... + def pis(self) -> list[offset_coordinate]: ... + def pos(self) -> list[offset_coordinate]: ... + def bounding_box_2d(self) -> tuple[offset_coordinate, offset_coordinate]: ... class inml_layout(clocked_cartesian_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: offset_coordinate) -> None: ... - @overload - def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", - layout_name: str = "") -> None: ... - + def __init__( + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: inml_technology.cell_type) -> None: ... - def get_cell_type(self, c: offset_coordinate) -> inml_technology.cell_type: ... - def is_empty_cell(self, c: offset_coordinate) -> bool: ... - def assign_cell_name(self, c: offset_coordinate, n: str) -> None: ... - - def get_cell_name(self, c: offset_coordinate) -> Optional[str]: ... - + def get_cell_name(self, c: offset_coordinate) -> str | None: ... def set_layout_name(self, name: str) -> None: ... - def get_layout_name(self) -> str: ... - def num_cells(self) -> int: ... - def is_empty(self) -> bool: ... - def num_pis(self) -> int: ... - def num_pos(self) -> int: ... - def is_pi(self, c: offset_coordinate) -> bool: ... - def is_po(self, c: offset_coordinate) -> bool: ... - - def cells(self) -> List[offset_coordinate]: ... - - def pis(self) -> List[offset_coordinate]: ... - - def pos(self) -> List[offset_coordinate]: ... - - def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... - - def __repr__(self) -> str: ... - + def cells(self) -> list[offset_coordinate]: ... + def pis(self) -> list[offset_coordinate]: ... + def pos(self) -> list[offset_coordinate]: ... + def bounding_box_2d(self) -> tuple[offset_coordinate, offset_coordinate]: ... class sidb_layout(clocked_cartesian_layout): @overload def __init__(self) -> None: ... - @overload def __init__(self, dimension: offset_coordinate) -> None: ... - @overload - def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", - layout_name: str = "") -> None: ... - + def __init__( + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: sidb_technology.cell_type) -> None: ... - def get_cell_type(self, c: offset_coordinate) -> sidb_technology.cell_type: ... - def is_empty_cell(self, c: offset_coordinate) -> bool: ... - def assign_cell_name(self, c: offset_coordinate, n: str) -> None: ... - - def get_cell_name(self, c: offset_coordinate) -> Optional[str]: ... - + def get_cell_name(self, c: offset_coordinate) -> str | None: ... def set_layout_name(self, name: str) -> None: ... - def get_layout_name(self) -> str: ... - def num_cells(self) -> int: ... - def is_empty(self) -> bool: ... - def num_pis(self) -> int: ... - def num_pos(self) -> int: ... - def is_pi(self, c: offset_coordinate) -> bool: ... - def is_po(self, c: offset_coordinate) -> bool: ... - - def cells(self) -> List[offset_coordinate]: ... - - def pis(self) -> List[offset_coordinate]: ... - - def pos(self) -> List[offset_coordinate]: ... - - def bounding_box_2d(self) -> Tuple[offset_coordinate, offset_coordinate]: ... - - def __repr__(self) -> str: ... - + def cells(self) -> list[offset_coordinate]: ... + def pis(self) -> list[offset_coordinate]: ... + def pos(self) -> list[offset_coordinate]: ... + def bounding_box_2d(self) -> tuple[offset_coordinate, offset_coordinate]: ... # Networks class technology_network_node: def __hash__(self) -> int: ... - class technology_network: def __init__(self) -> None: ... - def size(self) -> int: ... - def num_gates(self) -> int: ... - def num_pis(self) -> int: ... - def num_pos(self) -> int: ... - - def nodes(self) -> List[technology_network_node]: ... - - def gates(self) -> List[technology_network_node]: ... - - def pis(self) -> List[technology_network_node]: ... - - def pos(self) -> List[technology_network_node]: ... - - def fanins(self, n: technology_network_node) -> List[technology_network_node]: ... - + def nodes(self) -> list[technology_network_node]: ... + def gates(self) -> list[technology_network_node]: ... + def pis(self) -> list[technology_network_node]: ... + def pos(self) -> list[technology_network_node]: ... + def fanins(self, n: technology_network_node) -> list[technology_network_node]: ... def is_constant(self, n: technology_network_node) -> bool: ... - def is_pi(self, n: technology_network_node) -> bool: ... - def is_po(self, n: technology_network_node) -> bool: ... - def is_buf(self, n: technology_network_node) -> bool: ... - def is_fanout(self, n: technology_network_node) -> bool: ... - def is_inv(self, n: technology_network_node) -> bool: ... - def is_and(self, n: technology_network_node) -> bool: ... - def is_or(self, n: technology_network_node) -> bool: ... - def is_xor(self, n: technology_network_node) -> bool: ... - def is_maj(self, n: technology_network_node) -> bool: ... - def is_nand(self, n: technology_network_node) -> bool: ... - def is_nor(self, n: technology_network_node) -> bool: ... - def is_xnor(self, n: technology_network_node) -> bool: ... - def has_name(self, n: technology_network_node) -> bool: ... - - def get_name(self, n: technology_network_node) -> Optional[str]: ... - + def get_name(self, n: technology_network_node) -> str | None: ... def has_output_name(self, index: int) -> bool: ... - - def get_output_name(self, index: int) -> Optional[str]: ... - + def get_output_name(self, index: int) -> str | None: ... def po_index(self, n: technology_network_node) -> int: ... - def po_at(self, index: int) -> technology_network_node: ... - def read_technology_network(filename: str) -> technology_network: ... - class dynamic_truth_table: @overload def __init__(self) -> None: ... - @overload def __init__(self, num_vars: int) -> None: ... - def num_vars(self) -> int: ... - def num_blocks(self) -> int: ... - def num_bits(self) -> int: ... - # Algorithms ## network transformation - class substitution_strategy: BREADTH: int DEPTH: int - class fanout_substitution_params: def __init__(self) -> None: ... strategy: substitution_strategy - degree: Optional[int] - threshold: Optional[int] - - -def fanout_substitution(network: technology_network, - params: Optional[ - fanout_substitution_params] = fanout_substitution_params()) -> technology_network: ... - - -def is_fanout_substituted(network: technology_network, - params: Optional[fanout_substitution_params] = fanout_substitution_params()) -> bool: ... + degree: int | None + threshold: int | None +def fanout_substitution( + network: technology_network, params: fanout_substitution_params | None = ... +) -> technology_network: ... +def is_fanout_substituted(network: technology_network, params: fanout_substitution_params | None = ...) -> bool: ... class network_balancing_params: def __init__(self) -> None: ... unify_outputs: bool - -def network_balancing(network: technology_network, - params: Optional[ - network_balancing_params] = network_balancing_params()) -> technology_network: ... - - -def is_balanced(network: technology_network, - params: Optional[network_balancing_params] = network_balancing_params()) -> bool: ... - - -from typing import Optional, List - +def network_balancing( + network: technology_network, params: network_balancing_params | None = ... +) -> technology_network: ... +def is_balanced(network: technology_network, params: network_balancing_params | None = ...) -> bool: ... class technology_mapping_params: def __init__(self) -> None: ... - decay: Optional[float] - inv: Optional[bool] - and2: Optional[bool] - nand2: Optional[bool] - or2: Optional[bool] - nor2: Optional[bool] - xor2: Optional[bool] - xnor2: Optional[bool] - and3: Optional[bool] - xor_and: Optional[bool] - or_and: Optional[bool] - onehot: Optional[bool] - maj3: Optional[bool] - gamble: Optional[bool] - dot: Optional[bool] - mux: Optional[bool] - and_xor: Optional[bool] - + decay: float | None + inv: bool | None + and2: bool | None + nand2: bool | None + or2: bool | None + nor2: bool | None + xor2: bool | None + xnor2: bool | None + and3: bool | None + xor_and: bool | None + or_and: bool | None + onehot: bool | None + maj3: bool | None + gamble: bool | None + dot: bool | None + mux: bool | None + and_xor: bool | None class technology_mapping_stats: - def __init__(self) -> None: ... - def report(self) -> None: ... - def __repr__(self) -> str: ... - - def and_or_not() -> technology_mapping_params: ... - - def and_or_not_maj() -> technology_mapping_params: ... - - def all_standard_2_input_functions() -> technology_mapping_params: ... - - def all_standard_3_input_functions() -> technology_mapping_params: ... - - def all_supported_standard_functions() -> technology_mapping_params: ... - - -def technology_mapping(network: technology_network, - params: Optional[technology_mapping_params] = technology_mapping_params(), - stats: Optional[technology_mapping_stats] = None) -> technology_network: ... - +def technology_mapping( + network: technology_network, + params: technology_mapping_params | None = ..., + stats: technology_mapping_stats | None = None, +) -> technology_network: ... ## path finding - @overload -def manhattan_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, - target: offset_coordinate) -> int: ... - - +def manhattan_distance( + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate +) -> int: ... @overload def manhattan_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... - - @overload -def euclidean_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, - target: offset_coordinate) -> float: ... - - +def euclidean_distance( + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate +) -> float: ... @overload def euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... - - @overload -def squared_euclidean_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, - target: offset_coordinate) -> float: ... - - +def squared_euclidean_distance( + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate +) -> float: ... @overload def squared_euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... - - @overload -def twoddwave_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, - target: offset_coordinate) -> int: ... - - +def twoddwave_distance( + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate +) -> int: ... @overload def twoddwave_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... - - @overload -def chebyshev_distance(layout: Union[cartesian_layout, shifted_cartesian_layout], source: offset_coordinate, - target: offset_coordinate) -> int: ... - - +def chebyshev_distance( + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate +) -> int: ... @overload def chebyshev_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... - class a_star_params: - def __init__(self): ... + def __init__(self) -> None: ... crossings: bool - @overload def a_star( - layout: Union[ - cartesian_obstruction_layout, - cartesian_gate_layout, - cartesian_layout, - shifted_cartesian_obstruction_layout, - shifted_cartesian_gate_layout, - shifted_cartesian_layout - ], - source: offset_coordinate, - target: offset_coordinate, - params: Optional[a_star_params] = a_star_params() -) -> List[offset_coordinate]: ... - - + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + params: a_star_params | None = ..., +) -> list[offset_coordinate]: ... @overload def a_star( - layout: Union[ - hexagonal_obstruction_layout, - hexagonal_gate_layout, - hexagonal_layout - ], - source: cube_coordinate, - target: cube_coordinate, - params: Optional[a_star_params] = a_star_params() -) -> List[cube_coordinate]: ... - + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + params: a_star_params | None = ..., +) -> list[cube_coordinate]: ... class enumerate_all_paths_params: - def __init__(self): ... + def __init__(self) -> None: ... crossings: bool - @overload def enumerate_all_paths( - layout: Union[ - cartesian_obstruction_layout, - cartesian_gate_layout, - cartesian_layout, - shifted_cartesian_obstruction_layout, - shifted_cartesian_gate_layout, - shifted_cartesian_layout - ], - source: offset_coordinate, - target: offset_coordinate, - params: Optional[enumerate_all_paths_params] = enumerate_all_paths_params() -) -> List[List[offset_coordinate]]: ... - - + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + params: enumerate_all_paths_params | None = ..., +) -> list[list[offset_coordinate]]: ... @overload def enumerate_all_paths( - layout: Union[ - hexagonal_obstruction_layout, - hexagonal_gate_layout, - hexagonal_layout - ], - source: cube_coordinate, - target: cube_coordinate, - params: Optional[enumerate_all_paths_params] = enumerate_all_paths_params() -) -> List[List[cube_coordinate]]: ... - + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + params: enumerate_all_paths_params | None = ..., +) -> list[list[cube_coordinate]]: ... class yen_k_shortest_paths_params: - def __init__(self): ... + def __init__(self) -> None: ... astar_params: a_star_params - @overload def yen_k_shortest_paths( - layout: Union[ - cartesian_obstruction_layout, - cartesian_gate_layout, - cartesian_layout, - shifted_cartesian_obstruction_layout, - shifted_cartesian_gate_layout, - shifted_cartesian_layout - ], - source: offset_coordinate, - target: offset_coordinate, - k: int, - params: Optional[yen_k_shortest_paths_params] = yen_k_shortest_paths_params() -) -> List[List[offset_coordinate]]: ... - - + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + k: int, + params: yen_k_shortest_paths_params | None = ..., +) -> list[list[offset_coordinate]]: ... @overload def yen_k_shortest_paths( - layout: Union[ - hexagonal_obstruction_layout, - hexagonal_gate_layout, - hexagonal_layout - ], - source: cube_coordinate, - target: cube_coordinate, - k: int, - params: Optional[yen_k_shortest_paths_params] = yen_k_shortest_paths_params() -) -> List[List[cube_coordinate]]: ... - + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + k: int, + params: yen_k_shortest_paths_params | None = ..., +) -> list[list[cube_coordinate]]: ... # physical design def apply_qca_one_library(layout: cartesian_gate_layout) -> qca_layout: ... - - def apply_topolinano_library(layout: shifted_cartesian_gate_layout) -> inml_layout: ... - - def apply_bestagon_library(layout: hexagonal_gate_layout) -> sidb_layout: ... - class graph_coloring_engine(Enum): MCS = ... DSATUR = ... @@ -1636,42 +939,36 @@ class graph_coloring_engine(Enum): TABUCOL = ... SAT = ... - class color_routing_params: def __init__(self) -> None: ... conduct_partial_routing: bool crossings: bool - path_limit: Optional[int] + path_limit: int | None engine: graph_coloring_engine partial_sat: bool - @overload def color_routing( - layout: Union[ - cartesian_obstruction_layout, cartesian_gate_layout, shifted_cartesian_obstruction_layout, shifted_cartesian_gate_layout], - objectives: List[Tuple[offset_coordinate, offset_coordinate]], - params: Optional[color_routing_params] = color_routing_params() + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout, + objectives: list[tuple[offset_coordinate, offset_coordinate]], + params: color_routing_params | None = ..., ) -> bool: ... - - @overload def color_routing( - layout: Union[ - hexagonal_obstruction_layout, hexagonal_gate_layout], - objectives: List[Tuple[cube_coordinate, cube_coordinate]], - params: Optional[color_routing_params] = color_routing_params() + layout: hexagonal_obstruction_layout | hexagonal_gate_layout, + objectives: list[tuple[cube_coordinate, cube_coordinate]], + params: color_routing_params | None = ..., ) -> bool: ... - class technology_constraints(Enum): NONE: ... TOPOLINANO: ... - class exact_params: - def __init__(self) -> None: ... scheme: str @@ -1689,7 +986,6 @@ class exact_params: timeout: int technology_specifics: technology_constraints - class exact_stats: time_total: float x_size: int @@ -1700,37 +996,21 @@ class exact_stats: num_aspect_ratios: int def __init__(self) -> None: ... - def report(self) -> str: ... - def __repr__(self) -> str: ... - - def exact_cartesian( - network: technology_network, - parameters: Optional[exact_params] = None, - statistics: Optional[exact_stats] = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> cartesian_gate_layout: ... - - def exact_shifted_cartesian( - network: technology_network, - parameters: Optional[exact_params] = None, - statistics: Optional[exact_stats] = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> shifted_cartesian_gate_layout: ... - - def exact_hexagonal( - network: technology_network, - parameters: Optional[exact_params] = None, - statistics: Optional[exact_stats] = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> hexagonal_gate_layout: ... - class orthogonal_params: def __init__(self) -> None: ... - class orthogonal_stats: time_total: float x_size: int @@ -1740,25 +1020,17 @@ class orthogonal_stats: num_crossings: int def __init__(self) -> None: ... - def report(self) -> None: ... - def __repr__(self) -> str: ... - - def orthogonal( - network: technology_network, - parameters: Optional[orthogonal_params] = orthogonal_params(), - statistics: Optional[orthogonal_stats] = None + network: technology_network, parameters: orthogonal_params | None = ..., statistics: orthogonal_stats | None = None ) -> cartesian_gate_layout: ... - # properties def critical_path_length_and_throughput( - layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout]) -> Tuple[ - int, int]: ... - + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, +) -> tuple[int, int]: ... # TODO design_sidb_gates, gold, hexagonalization, PLO, wiring reduction @@ -1766,15 +1038,12 @@ def critical_path_length_and_throughput( ### logic - @overload -def simulate(network: technology_network) -> Dict[str, List[bool]]: ... - - +def simulate(network: technology_network) -> dict[str, list[bool]]: ... @overload -def simulate(layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout]) -> Dict[ - str, List[bool]]: ... - +def simulate( + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, +) -> dict[str, list[bool]]: ... ### sidb @@ -1783,7 +1052,6 @@ def simulate(layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, ## verification class gate_level_drv_params: - def __init__(self) -> None: ... unplaced_nodes: bool @@ -1797,174 +1065,115 @@ class gate_level_drv_params: io_pins: bool border_io: bool - def gate_level_drvs( - layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], - params: Optional[gate_level_drv_params] = gate_level_drv_params(), - print_report: Optional[bool] = False -) -> Tuple[int, int]: ... - + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + params: gate_level_drv_params | None = ..., + print_report: bool | None = False, +) -> tuple[int, int]: ... class eq_type(Enum): NO = ... WEAK = ... STRONG = ... - class equivalence_checking_stats: - def __init__(self) -> None: ... eq: eq_type tp_spec: int tp_impl: int tp_diff: int - counter_example: List[bool] + counter_example: list[bool] runtime: float - def equivalence_checking( - specification: Union[ - technology_network, cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], - implementation: Union[ - technology_network, cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], - statistics: Optional[equivalence_checking_stats] = None + specification: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + implementation: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + statistics: equivalence_checking_stats | None = None, ) -> eq_type: ... - # In/Out class fgl_parsing_error(RuntimeError): ... - def read_cartesian_fgl_layout(filename: str, layout_name: str = "") -> cartesian_gate_layout: ... - - def read_shifted_cartesian_fgl_layout(filename: str, layout_name: str = "") -> shifted_cartesian_gate_layout: ... - - def read_hexagonal_fgl_layout(filename: str, layout_name: str = "") -> hexagonal_gate_layout: ... - class unsupported_character_exception(Exception): ... - - class undefined_cell_label_exception(Exception): ... - - class unrecognized_cell_definition_exception(Exception): ... - def read_fqca_layout(filename: str, layout_name: str = "") -> qca_layout: ... - # TODO read_sqd_layout def write_dot_network(network: technology_network, filename: str) -> None: ... - - -def write_dot_layout(layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], - filename: str) -> None: ... - - -def write_fgl_layout(layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], - filename: str) -> None: ... - +def write_dot_layout( + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str +) -> None: ... +def write_fgl_layout( + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str +) -> None: ... class out_of_cell_names_exception(IndexError): ... - class write_fqca_layout_params: def __init__(self) -> None: ... create_inter_layer_via_cells: bool - def write_fqca_layout( - layout: Union[cartesian_gate_layout, shifted_cartesian_gate_layout, hexagonal_gate_layout], - filename: str, - params: Optional[write_fqca_layout_params] = write_fqca_layout_params() + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + filename: str, + params: write_fqca_layout_params | None = ..., ) -> None: ... - # TODO write_operational_domain class write_qca_layout_params: - def __init__(self) -> None: ... create_inter_layer_via_cells: bool - -def write_qca_layout( - layout: qca_layout, - filename: str, - params: Optional[write_qca_layout_params] = write_qca_layout_params() -) -> None: ... - - -def write_qcc_layout( - layout: inml_layout, - filename: str -) -> None: ... - - -def write_qll_layout( - layout: Union[qca_layout, inml_layout], - filename: str -) -> None: ... - - +def write_qca_layout(layout: qca_layout, filename: str, params: write_qca_layout_params | None = ...) -> None: ... +def write_qcc_layout(layout: inml_layout, filename: str) -> None: ... +def write_qll_layout(layout: qca_layout | inml_layout, filename: str) -> None: ... def write_sqd_layout( - # layout: Union[sidb_111_lattice, sidb_100_lattice, sidb_layout], # TODO move to this layout spec as soon as lattices are added - layout: sidb_layout, - filename: str -) -> None: ... - - -def write_sqd_sim_result( - layout: sidb_layout, - filename: str + # layout: Union[sidb_111_lattice, sidb_100_lattice, sidb_layout], # TODO move to this layout spec as soon as lattices are added + layout: sidb_layout, + filename: str, ) -> None: ... - +def write_sqd_sim_result(layout: sidb_layout, filename: str) -> None: ... # Technology @overload def area(layout: qca_layout, width: int = 18, height: int = 18, hspace: int = 2, vspace: int = 2) -> float: ... - - @overload def area(layout: inml_layout, width: int = 50, height: int = 100, hspace: int = 10, vspace: int = 25) -> float: ... - - @overload -def area(layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, - vspace: float = 0.384) -> float: ... +def area( + layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, vspace: float = 0.384 +) -> float: ... # TODO all SiDB technology class sidb_simulation_parameters: - epsilon_r: float lambda_tf: float mu_minus: float base: int def __init__( - self, - base_number: int = 3, - mu_minus: float = -0.32, - relative_permittivity: float = 5.6, - screening_distance: float = 5.0 - ) -> None: - ... - - def k(self) -> float: - ... - - def mu_plus(self) -> float: - ... + self, + base_number: int = 3, + mu_minus: float = -0.32, + relative_permittivity: float = 5.6, + screening_distance: float = 5.0, + ) -> None: ... + def k(self) -> float: ... + def mu_plus(self) -> float: ... # Utils diff --git a/bindings/mnt/pyfiction/test/layouts/test_coordinates.py b/bindings/mnt/pyfiction/test/layouts/test_coordinates.py index a95fe0ccf..18bf81574 100644 --- a/bindings/mnt/pyfiction/test/layouts/test_coordinates.py +++ b/bindings/mnt/pyfiction/test/layouts/test_coordinates.py @@ -1,7 +1,6 @@ -from mnt.pyfiction import (offset_coordinate, cube_coordinate, siqad_coordinate, area, volume) import unittest -from mnt.pyfiction import cube_coordinate, offset_coordinate, siqad_coordinate +from mnt.pyfiction import area, cube_coordinate, offset_coordinate, siqad_coordinate, volume class TestCoordinates(unittest.TestCase): From 55e1d81a4e6989eedd67d5062b65dd581530436e Mon Sep 17 00:00:00 2001 From: Simon Hofmann Date: Wed, 4 Dec 2024 21:00:14 +0100 Subject: [PATCH 31/42] :snake: expose hexagonalization stats --- .../physical_design/hexagonalization.hpp | 32 ++++++++++--------- .../physical_design/test_hexagonalization.py | 11 ++++++- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/hexagonalization.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/hexagonalization.hpp index 5d7080648..2a23d2bb3 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/hexagonalization.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/hexagonalization.hpp @@ -11,29 +11,31 @@ #include #include +#include namespace pyfiction { -namespace detail -{ - -template -void hexagonalization(pybind11::module& m) +inline void hexagonalization(pybind11::module& m) { namespace py = pybind11; - m.def( - "hexagonalization", [](const Lyt& lyt) -> py_hexagonal_gate_layout - { return fiction::hexagonalization(lyt); }, py::arg("layout"), - DOC(fiction_hexagonalization)); -} + py::class_(m, "hexagonalization_stats", + DOC(fiction_hexagonalization_stats)) + .def(py::init<>()) + .def("__repr__", + [](const fiction::hexagonalization_stats &stats) { + std::stringstream stream{}; + stats.report(stream); + return stream.str(); + }) + .def_readonly("time_total", &fiction::hexagonalization_stats::time_total, + DOC(fiction_hexagonalization_stats_duration)); + + m.def("hexagonalization", + &fiction::hexagonalization, py::arg("layout"), + py::arg("statistics") = nullptr, DOC(fiction_hexagonalization)); -} // namespace detail - -inline void hexagonalization(pybind11::module& m) -{ - detail::hexagonalization(m); } } // namespace pyfiction diff --git a/bindings/mnt/pyfiction/test/algorithms/physical_design/test_hexagonalization.py b/bindings/mnt/pyfiction/test/algorithms/physical_design/test_hexagonalization.py index 3c6c14e11..98177236b 100644 --- a/bindings/mnt/pyfiction/test/algorithms/physical_design/test_hexagonalization.py +++ b/bindings/mnt/pyfiction/test/algorithms/physical_design/test_hexagonalization.py @@ -1,7 +1,7 @@ import os import unittest -from mnt.pyfiction import eq_type, equivalence_checking, hexagonalization, orthogonal, read_technology_network +from mnt.pyfiction import eq_type, equivalence_checking, hexagonalization, hexagonalization_stats, orthogonal, read_technology_network dir_path = os.path.dirname(os.path.realpath(__file__)) @@ -15,6 +15,15 @@ def test_hexagonalization_default(self): self.assertEqual(equivalence_checking(network, hex_layout), eq_type.STRONG) self.assertEqual(equivalence_checking(cart_layout, hex_layout), eq_type.STRONG) + def test_hexagonalization_with_stats(self): + network = read_technology_network(dir_path + "/../../resources/mux21.v") + cart_layout = orthogonal(network) + self.assertEqual(equivalence_checking(network, cart_layout), eq_type.STRONG) + stats = hexagonalization_stats() + hex_layout = hexagonalization(cart_layout, statistics=stats) + self.assertEqual(equivalence_checking(network, hex_layout), eq_type.STRONG) + self.assertEqual(equivalence_checking(cart_layout, hex_layout), eq_type.STRONG) + if __name__ == "__main__": unittest.main() From 1946f06368159a35ca2536a24d3209ae5aef58cc Mon Sep 17 00:00:00 2001 From: Simon Hofmann Date: Wed, 4 Dec 2024 21:00:51 +0100 Subject: [PATCH 32/42] :label: Type interface for more physical design algorithms --- bindings/mnt/pyfiction/pyfiction.pyi | 102 ++++++++++++++++++++++++++- 1 file changed, 100 insertions(+), 2 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 526cf22e6..1e41fd931 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1008,6 +1008,55 @@ def exact_hexagonal( network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> hexagonal_gate_layout: ... +class gold_effort_mode(Enum): + HIGH_EFFICIENCY = ... + HIGH_EFFORT = ... + HIGHEST_EFFORT = ... + +class gold_cost_objective(Enum): + AREA = ... + WIRES = ... + CROSSINGS = ... + ACP = ... + CUSTOM = ... + +class graph_oriented_layout_design_params: + def __init__(self) -> None: ... + + timeout: int + num_vertex_expansions: int + verbose: bool + mode: gold_effort_mode + cost: gold_cost_objective + return_first: bool + planar: bool + enable_multithreading: bool + +class graph_oriented_layout_design_stats: + time_total: float + x_size: int + y_size: int + num_gates: int + num_wires: int + num_crossings: int + + def __init__(self) -> None: ... + def report(self) -> str: ... + +def graph_oriented_layout_design( + network: technology_network, parameters: graph_oriented_layout_design_params | None = ..., statistics: graph_oriented_layout_design_stats | None = None +) -> cartesian_gate_layout: ... + +class hexagonalization_stats: + time_total: float + + def __init__(self) -> None: ... + def report(self) -> str: ... + +def hexagonalization( + layout: cartesian_gate_layout, statistics: hexagonalization_stats | None = None +) -> hexagonal_gate_layout: ... + class orthogonal_params: def __init__(self) -> None: ... @@ -1023,16 +1072,65 @@ class orthogonal_stats: def report(self) -> None: ... def orthogonal( - network: technology_network, parameters: orthogonal_params | None = ..., statistics: orthogonal_stats | None = None + network: technology_network, parameters: orthogonal_params | None = ..., statistics: orthogonal_stats | None = None +) -> cartesian_gate_layout: ... + +class post_layout_optimization_params: + def __init__(self) -> None: ... + + timeout: int + max_gate_relocations: int + optimize_pos_only: bool + planar_optimization: bool + +class post_layout_optimization_stats: + time_total: float + x_size_before: int + y_size_before: int + x_size_after: int + y_size_after: int + area_improvement: float + num_wires_before: int + num_wires_after: int + num_crossings_before: int + num_crossings_after: int + + def __init__(self) -> None: ... + def report(self) -> str: ... + +def post_layout_optimization( + layout: cartesian_gate_layout, parameters: post_layout_optimization_params | None = ..., statistics: post_layout_optimization_stats | None = None ) -> cartesian_gate_layout: ... +class wiring_reduction_params: + def __init__(self) -> None: ... + + timeout: int + +class wiring_reduction_stats: + time_total: float + x_size_before: int + y_size_before: int + x_size_after: int + y_size_after: int + num_wires_before: int + num_wires_after: int + area_improvement: float + wiring_improvement: float + +def __init__(self) -> None: ... + def report(self) -> str: ... + +def wiring_reduction( + layout: cartesian_gate_layout, parameters: wiring_reduction_params | None = ..., statistics: wiring_reduction_stats | None = None +) -> cartesian_gate_layout: ... # properties def critical_path_length_and_throughput( layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, ) -> tuple[int, int]: ... -# TODO design_sidb_gates, gold, hexagonalization, PLO, wiring reduction +# TODO design_sidb_gates ## simulation From 1064ba7b7fff9676fc7cbb1fa2b4cbf0cd95d6f9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:04:00 +0000 Subject: [PATCH 33/42] =?UTF-8?q?=F0=9F=8E=A8=20Incorporated=20pre-commit?= =?UTF-8?q?=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../physical_design/hexagonalization.hpp | 31 +++++++++---------- .../physical_design/test_hexagonalization.py | 9 +++++- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/hexagonalization.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/hexagonalization.hpp index 2a23d2bb3..277cee9d9 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/hexagonalization.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/physical_design/hexagonalization.hpp @@ -11,6 +11,7 @@ #include #include + #include namespace pyfiction @@ -20,22 +21,20 @@ inline void hexagonalization(pybind11::module& m) { namespace py = pybind11; - py::class_(m, "hexagonalization_stats", - DOC(fiction_hexagonalization_stats)) - .def(py::init<>()) - .def("__repr__", - [](const fiction::hexagonalization_stats &stats) { - std::stringstream stream{}; - stats.report(stream); - return stream.str(); - }) - .def_readonly("time_total", &fiction::hexagonalization_stats::time_total, - DOC(fiction_hexagonalization_stats_duration)); - - m.def("hexagonalization", - &fiction::hexagonalization, py::arg("layout"), - py::arg("statistics") = nullptr, DOC(fiction_hexagonalization)); - + py::class_(m, "hexagonalization_stats", DOC(fiction_hexagonalization_stats)) + .def(py::init<>()) + .def("__repr__", + [](const fiction::hexagonalization_stats& stats) + { + std::stringstream stream{}; + stats.report(stream); + return stream.str(); + }) + .def_readonly("time_total", &fiction::hexagonalization_stats::time_total, + DOC(fiction_hexagonalization_stats_duration)); + + m.def("hexagonalization", &fiction::hexagonalization, + py::arg("layout"), py::arg("statistics") = nullptr, DOC(fiction_hexagonalization)); } } // namespace pyfiction diff --git a/bindings/mnt/pyfiction/test/algorithms/physical_design/test_hexagonalization.py b/bindings/mnt/pyfiction/test/algorithms/physical_design/test_hexagonalization.py index 98177236b..a3b139a6b 100644 --- a/bindings/mnt/pyfiction/test/algorithms/physical_design/test_hexagonalization.py +++ b/bindings/mnt/pyfiction/test/algorithms/physical_design/test_hexagonalization.py @@ -1,7 +1,14 @@ import os import unittest -from mnt.pyfiction import eq_type, equivalence_checking, hexagonalization, hexagonalization_stats, orthogonal, read_technology_network +from mnt.pyfiction import ( + eq_type, + equivalence_checking, + hexagonalization, + hexagonalization_stats, + orthogonal, + read_technology_network, +) dir_path = os.path.dirname(os.path.realpath(__file__)) From 919d72fd147f2421a162f3b6c9420db8e6d3c497 Mon Sep 17 00:00:00 2001 From: Drewniok Date: Thu, 5 Dec 2024 18:19:09 +0100 Subject: [PATCH 34/42] :art: add SiDB functionality to pyi. --- bindings/mnt/pyfiction/__init__.py | 1 - bindings/mnt/pyfiction/pyfiction.pyi | 997 ++++++++++++++++++++++++--- 2 files changed, 900 insertions(+), 98 deletions(-) diff --git a/bindings/mnt/pyfiction/__init__.py b/bindings/mnt/pyfiction/__init__.py index a88250508..610676b5b 100644 --- a/bindings/mnt/pyfiction/__init__.py +++ b/bindings/mnt/pyfiction/__init__.py @@ -36,7 +36,6 @@ apply_topolinano_library, # Technology area, - assess_physical_population_stability, assess_physical_population_stability_params, automatic_base_number_detection, bdl_input_iterator_100, diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 1e41fd931..3587bf4cf 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1,5 +1,5 @@ from enum import Enum -from typing import overload +from typing import Callable, overload # Layouts @@ -302,7 +302,7 @@ class cartesian_gate_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... @@ -388,7 +388,7 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... @@ -629,7 +629,7 @@ class qca_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: qca_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> qca_technology.cell_type: ... @@ -656,7 +656,7 @@ class inml_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: inml_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> inml_technology.cell_type: ... @@ -683,7 +683,7 @@ class sidb_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: sidb_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> sidb_technology.cell_type: ... @@ -703,6 +703,12 @@ class sidb_layout(clocked_cartesian_layout): def pos(self) -> list[offset_coordinate]: ... def bounding_box_2d(self) -> tuple[offset_coordinate, offset_coordinate]: ... +class sidb_100_lattice: + def __init__(self, dimension: offset_coordinate, name: str = "") -> None: ... + +class sidb_111_lattice: + def __init__(self, dimension: offset_coordinate, name: str = "") -> None: ... + # Networks class technology_network_node: @@ -766,7 +772,7 @@ class fanout_substitution_params: threshold: int | None def fanout_substitution( - network: technology_network, params: fanout_substitution_params | None = ... + network: technology_network, params: fanout_substitution_params | None = ... ) -> technology_network: ... def is_fanout_substituted(network: technology_network, params: fanout_substitution_params | None = ...) -> bool: ... @@ -776,7 +782,7 @@ class network_balancing_params: unify_outputs: bool def network_balancing( - network: technology_network, params: network_balancing_params | None = ... + network: technology_network, params: network_balancing_params | None = ... ) -> technology_network: ... def is_balanced(network: technology_network, params: network_balancing_params | None = ...) -> bool: ... @@ -811,40 +817,40 @@ def all_standard_2_input_functions() -> technology_mapping_params: ... def all_standard_3_input_functions() -> technology_mapping_params: ... def all_supported_standard_functions() -> technology_mapping_params: ... def technology_mapping( - network: technology_network, - params: technology_mapping_params | None = ..., - stats: technology_mapping_stats | None = None, + network: technology_network, + params: technology_mapping_params | None = ..., + stats: technology_mapping_stats | None = None, ) -> technology_network: ... ## path finding @overload def manhattan_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def manhattan_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @overload def euclidean_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> float: ... @overload def euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... @overload def squared_euclidean_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> float: ... @overload def squared_euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... @overload def twoddwave_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def twoddwave_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @overload def chebyshev_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def chebyshev_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @@ -856,22 +862,22 @@ class a_star_params: @overload def a_star( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - params: a_star_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + params: a_star_params | None = ..., ) -> list[offset_coordinate]: ... @overload def a_star( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - params: a_star_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + params: a_star_params | None = ..., ) -> list[cube_coordinate]: ... class enumerate_all_paths_params: @@ -881,22 +887,22 @@ class enumerate_all_paths_params: @overload def enumerate_all_paths( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - params: enumerate_all_paths_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + params: enumerate_all_paths_params | None = ..., ) -> list[list[offset_coordinate]]: ... @overload def enumerate_all_paths( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - params: enumerate_all_paths_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + params: enumerate_all_paths_params | None = ..., ) -> list[list[cube_coordinate]]: ... class yen_k_shortest_paths_params: @@ -906,24 +912,24 @@ class yen_k_shortest_paths_params: @overload def yen_k_shortest_paths( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - k: int, - params: yen_k_shortest_paths_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + k: int, + params: yen_k_shortest_paths_params | None = ..., ) -> list[list[offset_coordinate]]: ... @overload def yen_k_shortest_paths( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - k: int, - params: yen_k_shortest_paths_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + k: int, + params: yen_k_shortest_paths_params | None = ..., ) -> list[list[cube_coordinate]]: ... # physical design @@ -950,18 +956,18 @@ class color_routing_params: @overload def color_routing( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout, - objectives: list[tuple[offset_coordinate, offset_coordinate]], - params: color_routing_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout, + objectives: list[tuple[offset_coordinate, offset_coordinate]], + params: color_routing_params | None = ..., ) -> bool: ... @overload def color_routing( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout, - objectives: list[tuple[cube_coordinate, cube_coordinate]], - params: color_routing_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout, + objectives: list[tuple[cube_coordinate, cube_coordinate]], + params: color_routing_params | None = ..., ) -> bool: ... class technology_constraints(Enum): @@ -999,13 +1005,13 @@ class exact_stats: def report(self) -> str: ... def exact_cartesian( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> cartesian_gate_layout: ... def exact_shifted_cartesian( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> shifted_cartesian_gate_layout: ... def exact_hexagonal( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> hexagonal_gate_layout: ... class gold_effort_mode(Enum): @@ -1044,7 +1050,9 @@ class graph_oriented_layout_design_stats: def report(self) -> str: ... def graph_oriented_layout_design( - network: technology_network, parameters: graph_oriented_layout_design_params | None = ..., statistics: graph_oriented_layout_design_stats | None = None + network: technology_network, + parameters: graph_oriented_layout_design_params | None = ..., + statistics: graph_oriented_layout_design_stats | None = None, ) -> cartesian_gate_layout: ... class hexagonalization_stats: @@ -1099,7 +1107,9 @@ class post_layout_optimization_stats: def report(self) -> str: ... def post_layout_optimization( - layout: cartesian_gate_layout, parameters: post_layout_optimization_params | None = ..., statistics: post_layout_optimization_stats | None = None + layout: cartesian_gate_layout, + parameters: post_layout_optimization_params | None = ..., + statistics: post_layout_optimization_stats | None = None, ) -> cartesian_gate_layout: ... class wiring_reduction_params: @@ -1118,20 +1128,46 @@ class wiring_reduction_stats: area_improvement: float wiring_improvement: float -def __init__(self) -> None: ... + def __init__(self) -> None: ... def report(self) -> str: ... def wiring_reduction( - layout: cartesian_gate_layout, parameters: wiring_reduction_params | None = ..., statistics: wiring_reduction_stats | None = None + layout: cartesian_gate_layout, + parameters: wiring_reduction_params | None = ..., + statistics: wiring_reduction_stats | None = None, ) -> cartesian_gate_layout: ... + # properties def critical_path_length_and_throughput( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, ) -> tuple[int, int]: ... # TODO design_sidb_gates +class design_sidb_gates_stats: + def __init__(self) -> None: ... + +class design_sidb_gates_mode(Enum): + QUICKCELL: ... + AUTOMATIC_EXHAUSTIVE_GATE_DESIGNER: ... + RANDOM: ... + +class design_sidb_gates_params: + def __init__(self) -> None: ... + + operational_params: operational_domain_params + design_mode: design_sidb_gates_mode + canvas: [offset_coordinate, offset_coordinate] + number_of_sidbs: int + +def design_sidb_gates( + skeleton: sidb_100_lattice | sidb_111_lattice, + spec: [[int, int], int], + params: design_sidb_gates_params = ..., + stats: design_sidb_gates_stats | None = None, +) -> list[sidb_100_lattice | sidb_111_lattice]: ... + ## simulation ### logic @@ -1140,7 +1176,7 @@ def critical_path_length_and_throughput( def simulate(network: technology_network) -> dict[str, list[bool]]: ... @overload def simulate( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, ) -> dict[str, list[bool]]: ... ### sidb @@ -1164,9 +1200,9 @@ class gate_level_drv_params: border_io: bool def gate_level_drvs( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - params: gate_level_drv_params | None = ..., - print_report: bool | None = False, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + params: gate_level_drv_params | None = ..., + print_report: bool | None = False, ) -> tuple[int, int]: ... class eq_type(Enum): @@ -1185,9 +1221,9 @@ class equivalence_checking_stats: runtime: float def equivalence_checking( - specification: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - implementation: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - statistics: equivalence_checking_stats | None = None, + specification: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + implementation: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + statistics: equivalence_checking_stats | None = None, ) -> eq_type: ... # In/Out @@ -1208,10 +1244,10 @@ def read_fqca_layout(filename: str, layout_name: str = "") -> qca_layout: ... def write_dot_network(network: technology_network, filename: str) -> None: ... def write_dot_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str ) -> None: ... def write_fgl_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str ) -> None: ... class out_of_cell_names_exception(IndexError): ... @@ -1222,9 +1258,9 @@ class write_fqca_layout_params: create_inter_layer_via_cells: bool def write_fqca_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - filename: str, - params: write_fqca_layout_params | None = ..., + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + filename: str, + params: write_fqca_layout_params | None = ..., ) -> None: ... # TODO write_operational_domain @@ -1238,9 +1274,8 @@ def write_qca_layout(layout: qca_layout, filename: str, params: write_qca_layout def write_qcc_layout(layout: inml_layout, filename: str) -> None: ... def write_qll_layout(layout: qca_layout | inml_layout, filename: str) -> None: ... def write_sqd_layout( - # layout: Union[sidb_111_lattice, sidb_100_lattice, sidb_layout], # TODO move to this layout spec as soon as lattices are added - layout: sidb_layout, - filename: str, + layout: sidb_111_lattice | sidb_100_lattice | sidb_layout, + filename: str, ) -> None: ... def write_sqd_sim_result(layout: sidb_layout, filename: str) -> None: ... @@ -1252,27 +1287,795 @@ def area(layout: qca_layout, width: int = 18, height: int = 18, hspace: int = 2, def area(layout: inml_layout, width: int = 50, height: int = 100, hspace: int = 10, vspace: int = 25) -> float: ... @overload def area( - layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, vspace: float = 0.384 + layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, vspace: float = 0.384 ) -> float: ... # TODO all SiDB technology +class input_bdl_configuration(Enum): + PERTURBER_ABSENCE_ENCODED: ... + PERTURBER_DISTANCE_ENCODED: ... + +# Class for BDL input iterator parameters +class bdl_input_iterator_params: + def __init__(self) -> None: ... + + bdl_wire_params: detect_bdl_wires_params + input_bdl_config: input_bdl_configuration + +# Class for BDL input iterator +class bdl_input_iterator: + def __init__(self, lyt: object, params: bdl_input_iterator_params) -> None: ... + def __next__(self) -> object: ... + def __eq__(self, n: int) -> bool: ... + def __ne__(self, n: int) -> bool: ... + def __lt__(self, n: int) -> bool: ... + def __le__(self, n: int) -> bool: ... + def __gt__(self, n: int) -> bool: ... + def __ge__(self, n: int) -> bool: ... + def __add__(self, n: int) -> bdl_input_iterator: ... + def __iadd__(self, n: int) -> bdl_input_iterator: ... + def __sub__(self, n: int) -> bdl_input_iterator: ... + def __isub__(self, n: int) -> bdl_input_iterator: ... + def __getitem__(self, n: int) -> bdl_input_iterator: ... + def num_input_pairs(self) -> int: ... + def get_layout(self) -> object: ... + +# Function to register BDL input iterator for different lattice types +def bdl_input_iterator_100(lyt: object, params: bdl_input_iterator_params) -> bdl_input_iterator: ... +def bdl_input_iterator_111(lyt: object, params: bdl_input_iterator_params) -> bdl_input_iterator: ... + +class bdl_pair: + def __init__(self, t: sidb_technology.cell_type, u: offset_coordinate, l: offset_coordinate) -> None: + self.type: sidb_technology.cell_type + self.upper: offset_coordinate + self.lower: offset_coordinate + +class detect_bdl_pairs_params: + def __init__(self) -> None: + self.minimum_distance: float + self.maximum_distance: float + +def detect_bdl_pairs( + lyt: sidb_100_lattice | sidb_111_lattice, + type: sidb_technology.cell_type | None = None, + params: detect_bdl_pairs_params = ..., +) -> list[bdl_pair]: ... + +class sidb_defect_type(Enum): + NONE: ... + DB: ... + SI_VACANCY: ... + SINGLE_DIHYDRIDE: ... + DIHYDRIDE_PAIR: ... + ONE_BY_ONE: ... + THREE_BY_ONE: ... + SILOXANE: ... + RAISED_SI: ... + MISSING_DIMER: ... + ETCH_PIT: ... + STEP_EDGE: ... + GUNK: ... + UNKNOWN: ... + +class sidb_defect: + def __init__( + self, + defect_type: sidb_defect_type = ..., + electric_charge: int = 0, + relative_permittivity: float = 0.0, + screening_distance: float = 0.0, + ) -> None: + def __eq__(self, rhs: sidb_defect) -> bool: ... + def __ne__(self, rhs: sidb_defect) -> bool: ... + + type: sidb_defect_type + charge: int + epsilon_r: float + lambda_tf: float + +def is_charged_defect_type(defect: sidb_defect_type) -> bool: ... +def is_neutral_defect_type(defect: sidb_defect_type) -> bool: ... +def is_positively_charged_defect(defect: sidb_defect_type) -> bool: ... +def is_negatively_charged_defect(defect: sidb_defect_type) -> bool: ... +def is_neutrally_charged_defect(defect: sidb_defect_type) -> bool: ... +def defect_extent( + defect: sidb_defect_type, + charged_defect_spacing_overwrite: float | None = None, + neutral_defect_spacing_overwrite: float | None = None, +) -> float: ... + +class sidb_charge_state(Enum): + NEGATIVE: int = -1 + NEUTRAL: int = 0 + POSITIVE: int = 1 + NONE: int = 127 + +def charge_state_to_sign(cs: sidb_charge_state) -> int: ... +def sign_to_charge_state(sg: int) -> sidb_charge_state: ... +def charge_configuration_to_string(charge_distribution: list[sidb_charge_state]) -> str: ... + +class dependent_cell_mode(Enum): + FIXED: ... + VARIABLE: ... + +class energy_calculation(Enum): + KEEP_OLD_ENERGY_VALUE: ... + UPDATE_ENERGY: ... + +class charge_distribution_mode(Enum): + UPDATE_CHARGE_DISTRIBUTION: ... + KEEP_CHARGE_DISTRIBUTION: ... + +class charge_index_mode(Enum): + UPDATE_CHARGE_INDEX: ... + KEEP_CHARGE_INDEX: ... + +class charge_distribution_history(Enum): + CONSIDER: ... + NEGLECT: ... + +class sidb_100_lattice_orientation(Enum): + LAT_A: float + LAT_B: float + LAT_C: tuple[float, float] + +class sidb_111_lattice_orientation(Enum): + LAT_A: float + LAT_B: float + LAT_C: tuple[float, float] + +class charge_distribution_surface_100(sidb_100_lattice): + def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... + @overload + def __init__( + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., + ) -> None: ... + @overload + def __init__(self, lyt: charge_distribution_surface_100) -> None: ... + def get_all_sidb_locations_in_nm(self) -> list[tuple[float, float, float]]: ... + def assign_cell_type(self, c: sidb_technology.cell_type, ct: int) -> None: ... + def assign_physical_parameters(self, params: sidb_simulation_parameters) -> None: ... + def get_phys_params(self) -> sidb_simulation_parameters: ... + def charge_exists(self, cs: sidb_charge_state) -> bool: ... + def cell_to_index(self, c: offset_coordinate) -> int: ... + def assign_charge_state( + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + ) -> None: ... + def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... + def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... + def assign_dependent_cell(self, dependent_cell: offset_coordinate) -> None: ... + def assign_base_number(self, base: int) -> None: ... + def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... + def erase_defect(self, c: offset_coordinate) -> None: ... + def assign_charge_state_by_cell_index( + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + ) -> None: ... + def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... + def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... + def get_all_sidb_charges(self) -> list[sidb_charge_state]: ... + def negative_sidb_detection(self) -> list[int]: ... + def get_nm_distance_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_nm_distance_by_indices(self, index1: int, index2: int) -> float: ... + def calculate_chargeless_potential_between_sidbs_by_index(self, index1: int, index2: int) -> float: ... + def calculate_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_chargeless_potential_by_indices(self, index1: int, index2: int) -> float: ... + def get_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def update_local_potential(self, consider_history: charge_distribution_history) -> None: ... + def get_local_potential(self, c: offset_coordinate) -> float: ... + def get_local_potential_by_index(self, index: int) -> float: ... + def assign_system_energy_to_zero(self) -> None: ... + def recompute_system_energy(self) -> None: ... + def get_system_energy(self) -> float: ... + def update_after_charge_change( + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., + ) -> None: ... + def validity_check(self) -> bool: ... + def is_physically_valid(self) -> bool: ... + def charge_distribution_to_index_general(self) -> int: ... + def charge_distribution_to_index(self) -> int: ... + def get_charge_index_and_base(self) -> tuple[int, int]: ... + def increase_charge_index_by_one( + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., + ) -> None: ... + def get_max_charge_index(self) -> int: ... + def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... + def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... + def assign_global_external_potential( + self, potential_value: float, dependent_cell: dependent_cell_mode = ... + ) -> None: ... + def is_three_state_simulation_required(self) -> bool: ... + def get_positive_candidates(self) -> list[int]: ... + def three_state_cell_to_index(self, c: offset_coordinate) -> int: ... + def two_state_cell_to_index(self, c: offset_coordinate) -> int: ... + def index_to_cell(self, index: int) -> offset_coordinate: ... + def index_to_three_state_cell(self, index: int) -> offset_coordinate: ... + def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... + def chargeless_potential_at_given_distance(self, distance: float) -> float: ... + def chargeless_potential_generated_by_defect_at_given_distance( + self, distance: float, defect: sidb_defect + ) -> float: ... + def assign_local_external_potential(self, external_potential: float) -> None: ... + def get_local_external_potentials(self) -> list[float]: ... + def get_local_defect_potentials(self) -> list[float]: ... + def get_defects(self) -> list[sidb_defect]: ... + def update_charge_state_of_dependent_cell(self) -> None: ... + def get_charge_index_of_sub_layout(self) -> int: ... + def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... + def increase_charge_index_of_sub_layout_by_one( + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., + ) -> None: ... + def assign_charge_index_by_gray_code( + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., + ) -> None: ... + def reset_charge_index_sub_layout(self) -> None: ... + def get_max_charge_index_sub_layout(self) -> int: ... + def assign_charge_index_by_two_gray_codes(self, gray_code: int, gray_code_old: int) -> None: ... + def get_sidb_order(self) -> list[int]: ... + def add_sidb(self, cell: offset_coordinate, charge: int) -> None: ... + def cells(self) -> list[tuple[int, int, int]]: ... + def pis(self) -> list[tuple[int, int, int]]: ... + def pos(self) -> list[tuple[int, int, int]]: ... + def is_within_bounds(self, c: tuple[int, int, int]) -> bool: ... + def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... + +class charge_distribution_surface_111(sidb_111_lattice): + def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... + @overload + def __init__( + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., + ) -> None: ... + @overload + def __init__(self, lyt: charge_distribution_surface_100) -> None: ... + def get_all_sidb_locations_in_nm(self) -> list[tuple[float, float, float]]: ... + def assign_cell_type(self, c: sidb_technology.cell_type, ct: int) -> None: ... + def assign_physical_parameters(self, params: sidb_simulation_parameters) -> None: ... + def get_phys_params(self) -> sidb_simulation_parameters: ... + def charge_exists(self, cs: sidb_charge_state) -> bool: ... + def cell_to_index(self, c: offset_coordinate) -> int: ... + def assign_charge_state( + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + ) -> None: ... + def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... + def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... + def assign_dependent_cell(self, dependent_cell: offset_coordinate) -> None: ... + def assign_base_number(self, base: int) -> None: ... + def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... + def erase_defect(self, c: offset_coordinate) -> None: ... + def assign_charge_state_by_cell_index( + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + ) -> None: ... + def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... + def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... + def get_all_sidb_charges(self) -> list[sidb_charge_state]: ... + def negative_sidb_detection(self) -> list[int]: ... + def get_nm_distance_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_nm_distance_by_indices(self, index1: int, index2: int) -> float: ... + def calculate_chargeless_potential_between_sidbs_by_index(self, index1: int, index2: int) -> float: ... + def calculate_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_chargeless_potential_by_indices(self, index1: int, index2: int) -> float: ... + def get_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def update_local_potential(self, consider_history: charge_distribution_history) -> None: ... + def get_local_potential(self, c: offset_coordinate) -> float: ... + def get_local_potential_by_index(self, index: int) -> float: ... + def assign_system_energy_to_zero(self) -> None: ... + def recompute_system_energy(self) -> None: ... + def get_system_energy(self) -> float: ... + def update_after_charge_change( + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., + ) -> None: ... + def validity_check(self) -> bool: ... + def is_physically_valid(self) -> bool: ... + def charge_distribution_to_index_general(self) -> int: ... + def charge_distribution_to_index(self) -> int: ... + def get_charge_index_and_base(self) -> tuple[int, int]: ... + def increase_charge_index_by_one( + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., + ) -> None: ... + def get_max_charge_index(self) -> int: ... + def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... + def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... + def assign_global_external_potential( + self, potential_value: float, dependent_cell: dependent_cell_mode = ... + ) -> None: ... + def is_three_state_simulation_required(self) -> bool: ... + def get_positive_candidates(self) -> list[int]: ... + def three_state_cell_to_index(self, c: offset_coordinate) -> int: ... + def two_state_cell_to_index(self, c: offset_coordinate) -> int: ... + def index_to_cell(self, index: int) -> offset_coordinate: ... + def index_to_three_state_cell(self, index: int) -> offset_coordinate: ... + def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... + def chargeless_potential_at_given_distance(self, distance: float) -> float: ... + def chargeless_potential_generated_by_defect_at_given_distance( + self, distance: float, defect: sidb_defect + ) -> float: ... + def assign_local_external_potential(self, external_potential: float) -> None: ... + def get_local_external_potentials(self) -> list[float]: ... + def get_local_defect_potentials(self) -> list[float]: ... + def get_defects(self) -> list[sidb_defect]: ... + def update_charge_state_of_dependent_cell(self) -> None: ... + def get_charge_index_of_sub_layout(self) -> int: ... + def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... + def increase_charge_index_of_sub_layout_by_one( + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., + ) -> None: ... + def assign_charge_index_by_gray_code( + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., + ) -> None: ... + def reset_charge_index_sub_layout(self) -> None: ... + def get_max_charge_index_sub_layout(self) -> int: ... + def assign_charge_index_by_two_gray_codes(self, gray_code: int, gray_code_old: int) -> None: ... + def get_sidb_order(self) -> list[int]: ... + def add_sidb(self, cell: offset_coordinate, charge: int) -> None: ... + def cells(self) -> list[tuple[int, int, int]]: ... + def pis(self) -> list[tuple[int, int, int]]: ... + def pos(self) -> list[tuple[int, int, int]]: ... + def is_within_bounds(self, c: tuple[int, int, int]) -> bool: ... + def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... + +class charge_distribution_surface(sidb_layout): + def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... + @overload + def __init__( + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., + ) -> None: ... + @overload + def __init__(self, lyt: charge_distribution_surface_100) -> None: ... + def get_all_sidb_locations_in_nm(self) -> list[tuple[float, float, float]]: ... + def assign_cell_type(self, c: sidb_technology.cell_type, ct: int) -> None: ... + def assign_physical_parameters(self, params: sidb_simulation_parameters) -> None: ... + def get_phys_params(self) -> sidb_simulation_parameters: ... + def charge_exists(self, cs: sidb_charge_state) -> bool: ... + def cell_to_index(self, c: offset_coordinate) -> int: ... + def assign_charge_state( + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + ) -> None: ... + def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... + def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... + def assign_dependent_cell(self, dependent_cell: offset_coordinate) -> None: ... + def assign_base_number(self, base: int) -> None: ... + def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... + def erase_defect(self, c: offset_coordinate) -> None: ... + def assign_charge_state_by_cell_index( + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + ) -> None: ... + def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... + def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... + def get_all_sidb_charges(self) -> list[sidb_charge_state]: ... + def negative_sidb_detection(self) -> list[int]: ... + def get_nm_distance_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_nm_distance_by_indices(self, index1: int, index2: int) -> float: ... + def calculate_chargeless_potential_between_sidbs_by_index(self, index1: int, index2: int) -> float: ... + def calculate_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_chargeless_potential_by_indices(self, index1: int, index2: int) -> float: ... + def get_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def update_local_potential(self, consider_history: charge_distribution_history) -> None: ... + def get_local_potential(self, c: offset_coordinate) -> float: ... + def get_local_potential_by_index(self, index: int) -> float: ... + def assign_system_energy_to_zero(self) -> None: ... + def recompute_system_energy(self) -> None: ... + def get_system_energy(self) -> float: ... + def update_after_charge_change( + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., + ) -> None: ... + def validity_check(self) -> bool: ... + def is_physically_valid(self) -> bool: ... + def charge_distribution_to_index_general(self) -> int: ... + def charge_distribution_to_index(self) -> int: ... + def get_charge_index_and_base(self) -> tuple[int, int]: ... + def increase_charge_index_by_one( + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., + ) -> None: ... + def get_max_charge_index(self) -> int: ... + def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... + def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... + def assign_global_external_potential( + self, potential_value: float, dependent_cell: dependent_cell_mode = ... + ) -> None: ... + def is_three_state_simulation_required(self) -> bool: ... + def get_positive_candidates(self) -> list[int]: ... + def three_state_cell_to_index(self, c: offset_coordinate) -> int: ... + def two_state_cell_to_index(self, c: offset_coordinate) -> int: ... + def index_to_cell(self, index: int) -> offset_coordinate: ... + def index_to_three_state_cell(self, index: int) -> offset_coordinate: ... + def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... + def chargeless_potential_at_given_distance(self, distance: float) -> float: ... + def chargeless_potential_generated_by_defect_at_given_distance( + self, distance: float, defect: sidb_defect + ) -> float: ... + def assign_local_external_potential(self, external_potential: float) -> None: ... + def get_local_external_potentials(self) -> list[float]: ... + def get_local_defect_potentials(self) -> list[float]: ... + def get_defects(self) -> list[sidb_defect]: ... + def update_charge_state_of_dependent_cell(self) -> None: ... + def get_charge_index_of_sub_layout(self) -> int: ... + def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... + def increase_charge_index_of_sub_layout_by_one( + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., + ) -> None: ... + def assign_charge_index_by_gray_code( + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., + ) -> None: ... + def reset_charge_index_sub_layout(self) -> None: ... + def get_max_charge_index_sub_layout(self) -> int: ... + def assign_charge_index_by_two_gray_codes(self, gray_code: int, gray_code_old: int) -> None: ... + def get_sidb_order(self) -> list[int]: ... + def add_sidb(self, cell: offset_coordinate, charge: int) -> None: ... + def cells(self) -> list[tuple[int, int, int]]: ... + def pis(self) -> list[tuple[int, int, int]]: ... + def pos(self) -> list[tuple[int, int, int]]: ... + def is_within_bounds(self, c: tuple[int, int, int]) -> bool: ... + def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... + +class sidb_simulation_engine(Enum): + EXGS: ... + QUICKSIM: ... + QUICKEXACT: ... + +class exact_sidb_simulation_engine(Enum): + EXGS: ... + QUICKEXACT: ... + +@overload +def sidb_nm_position( + lyt: charge_distribution_surface | sidb_layout | sidb_100_lattice | sidb_111_lattice, c: sidb_technology.cell_type +) -> None: ... +@overload +def sidb_nm_distance_111(lyt: sidb_111_lattice, c: sidb_technology.cell_type) -> None: ... + class sidb_simulation_parameters: + def __init__( + self, + base_number: int = 3, + mu_minus: float = -0.32, + relative_permittivity: float = 5.6, + screening_distance: float = 5.0, + ) -> None: ... + def k(self) -> float: ... + def mu_plus(self) -> float: ... + epsilon_r: float lambda_tf: float mu_minus: float base: int +class transition_type(Enum): + NEUTRAL_TO_NEGATIVE: ... + NEGATIVE_TO_NEUTRAL: ... + NEUTRAL_TO_POSITIVE: ... + POSITIVE_TO_NEUTRAL: ... + +class population_stability_information: + def __init__(self) -> None: ... + + critical_cell: tuple[int, int] + transition_from_to: transition_type + minimum_potential_difference_to_transition: float + distance_corresponding_to_potential: float + system_energy: float + +class assess_physical_population_stability_params: + def __init__(self) -> None: ... + + simulation_parameters: sidb_simulation_parameters + precision_for_distance_corresponding_to_potential: float + +def assess_physical_population_stability_100( + lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... +) -> list[population_stability_information]: ... +def assess_physical_population_stability_111( + lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... +) -> list[population_stability_information]: ... +def energy_distribution(input_vec: list[charge_distribution_surface]) -> dict[float, int]: ... + +class bdl_wire_selection(Enum): + ALL: ... + INPUT: ... + OUTPUT: ... + +class bdl_wire_100(sidb_100_lattice): + def __init__(self, p: list[bdl_pair]) -> None: ... + + pairs: list[bdl_pair] + direction: int + first_bdl_pair: bdl_pair + last_bdl_pair: bdl_pair + +class bdl_wire_111(sidb_111_lattice): + def __init__(self, p: list[bdl_pair]) -> None: ... + + pairs: list[bdl_pair] + direction: int + first_bdl_pair: bdl_pair + last_bdl_pair: bdl_pair + +class detect_bdl_wires_params: + def __init__(self) -> None: ... + + threshold_bdl_interdistance: float + bdl_pairs_params: object + +def detect_bdl_wires_100( + lyt: sidb_100_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... +) -> list[bdl_wire_100]: ... +def detect_bdl_wires_111( + lyt: sidb_111_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... +) -> list[bdl_wire_111]: ... + +# Enums +class operational_status: + OPERATIONAL: ... + NON_OPERATIONAL: ... + +class operational_condition: + TOLERATE_KINKS: ... + REJECT_KINKS: ... + +# Class Definitions +class is_operational_params: + def __init__(self) -> None: ... + + simulation_parameters: sidb_simulation_parameters + sim_engine: sidb_simulation_engine + input_bdl_iterator_params: bdl_input_iterator_params + op_condition: operational_condition + +# Functions + +@overload +def is_operational( + lyt: sidb_100_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: bdl_wire_100 | None = None, + output_bdl_wire: bdl_wire_100 | None = None, +) -> operational_status: ... +@overload +def is_operational( + lyt: sidb_100_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: bdl_wire_111 | None = None, + output_bdl_wire: bdl_wire_111 | None = None, +) -> operational_status: ... +@overload +def operational_input_patterns( + lyt: sidb_100_lattice, + spec: object, # Type depends on the specification + params: is_operational_params = ..., +) -> list[int]: ... +@overload +def operational_input_patterns( + lyt: sidb_111_lattice, + spec: object, # Type depends on the specification + params: is_operational_params = ..., +) -> list[int]: ... +def is_kink_induced_non_operational( + lyt: sidb_100_lattice | sidb_111_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: object | None = None, + output_bdl_wire: object | None = None, +) -> operational_status: ... +def kink_induced_non_operational_input_patterns( + lyt: sidb_100_lattice | sidb_111_lattice, + spec: object, + params: is_operational_params = ..., +) -> object: ... + +# QuickExact +class quickexact_params: + def __init__(self) -> None: + self.simulation_parameters: sidb_simulation_parameters + self.base_number_detection: automatic_base_number_detection + self.local_external_potential: float + self.global_potential: float + +class automatic_base_number_detection(Enum): + ON = ... + OFF = ... + +def quickexact(lyt: sidb_100_lattice | sidb_111_lattice, params: quickexact_params) -> None: ... + +# QuickSim +class quicksim_params: + def __init__(self) -> None: + self.simulation_parameters: sidb_simulation_parameters + self.iteration_steps: int + self.alpha: float + self.number_threads: int + +def quicksim(lyt: sidb_100_lattice, params: quicksim_params) -> None: ... + +class critical_temperature_stats: + def __init__(self) -> None: ... + def report(self) -> None: ... + + algorithm_name: str + num_valid_lyt: int + is_ground_state_transparent: float + +class critical_temperature_params: + def __init__(self) -> None: ... + + operational_params: dict + confidence_level: float + max_temperature: float + +def critical_temperature_gate_based( + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + params: critical_temperature_params | None = ..., + stats: critical_temperature_stats | None = ..., +) -> float | None: ... +def critical_temperature_non_gate_based( + lyt: sidb_100_lattice | sidb_111_lattice, + params: critical_temperature_params | None = ..., + stats: critical_temperature_stats | None = ..., +) -> float | None: ... + +class parameter_point: + def __init__(self, values: list[float] | None = None) -> None: ... + def __hash__(self) -> int: ... + def __eq__(self, other: parameter_point) -> bool: ... + def __ne__(self, other: parameter_point) -> bool: ... + + parameters: list[float] + +class sweep_parameter(Enum): + EPSILON_R: ... + LAMBDA_TF: ... + MU_MINUS: ... + +class operational_domain_value_range: def __init__( - self, - base_number: int = 3, - mu_minus: float = -0.32, - relative_permittivity: float = 5.6, - screening_distance: float = 5.0, + self, dimension: sweep_parameter, min: float | None = None, max: float | None = None, step: float | None = None ) -> None: ... - def k(self) -> float: ... - def mu_plus(self) -> float: ... + + dimension: sweep_parameter + min: float + max: float + step: float + +class operational_domain_params: + def __init__(self) -> None: ... + + operational_params: dict[str, float] + sweep_dimensions: list[operational_domain_value_range] + +class operational_domain_stats: + def __init__(self) -> None: ... + + time_total: float + num_simulator_invocations: int + num_evaluated_parameter_combinations: int + num_operational_parameter_combinations: int + num_non_operational_parameter_combinations: int + num_total_parameter_points: int + +class operational_domain: + def __init__(self) -> None: ... + + dimensions: list[operational_domain_value_range] + operational_values: dict[parameter_point, str] + +def get_value(self, point: parameter_point) -> str: ... +def operational_domain_grid_search( + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, +) -> operational_domain | None: ... +def operational_domain_random_sampling( + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, +) -> operational_domain | None: ... +def operational_domain_flood_fill( + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, +) -> operational_domain | None: ... +def operational_domain_contour_tracing( + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, +) -> operational_domain | None: ... # Utils +# Functions to create various types of truth tables +def create_id_tt() -> Callable[[int], int]: ... +def create_not_tt() -> Callable[[int], int]: ... +def create_and_tt() -> Callable[[int, int], int]: ... +def create_or_tt() -> Callable[[int, int], int]: ... +def create_nand_tt() -> Callable[[int, int], int]: ... +def create_nor_tt() -> Callable[[int, int], int]: ... +def create_xor_tt() -> Callable[[int, int], int]: ... +def create_xnor_tt() -> Callable[[int, int], int]: ... +def create_lt_tt() -> Callable[[int, int], int]: ... +def create_gt_tt() -> Callable[[int, int], int]: ... +def create_le_tt() -> Callable[[int, int], int]: ... +def create_ge_tt() -> Callable[[int, int], int]: ... +def create_and3_tt() -> Callable[[int, int, int], int]: ... +def create_xor_and_tt() -> Callable[[int, int, int], int]: ... +def create_or_and_tt() -> Callable[[int, int, int], int]: ... +def create_onehot_tt() -> Callable[[int], int]: ... +def create_maj_tt() -> Callable[[int, int, int], int]: ... +def create_gamble_tt() -> Callable[[int, int], int]: ... +def create_dot_tt() -> Callable[[int, int], int]: ... +def create_ite_tt() -> Callable[[int, int, int], int]: ... +def create_and_xor_tt() -> Callable[[int, int, int], int]: ... +def create_xor3_tt() -> Callable[[int, int, int], int]: ... +def create_double_wire_tt() -> Callable[[int, int], int]: ... +def create_crossing_wire_tt() -> Callable[[int, int], int]: ... +def create_fan_out_tt() -> Callable[[int], int]: ... +def create_half_adder_tt() -> Callable[[int, int], int]: ... + # TODO all utils From 3c0fbd29d8aa214fa424a16f872c08c273af325b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:19:57 +0000 Subject: [PATCH 35/42] =?UTF-8?q?=F0=9F=8E=A8=20Incorporated=20pre-commit?= =?UTF-8?q?=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bindings/mnt/pyfiction/pyfiction.pyi | 510 +++++++++++++-------------- 1 file changed, 255 insertions(+), 255 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 3587bf4cf..70d0c6f5c 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -302,7 +302,7 @@ class cartesian_gate_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... @@ -388,7 +388,7 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... @@ -629,7 +629,7 @@ class qca_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: qca_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> qca_technology.cell_type: ... @@ -656,7 +656,7 @@ class inml_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: inml_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> inml_technology.cell_type: ... @@ -683,7 +683,7 @@ class sidb_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: sidb_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> sidb_technology.cell_type: ... @@ -772,7 +772,7 @@ class fanout_substitution_params: threshold: int | None def fanout_substitution( - network: technology_network, params: fanout_substitution_params | None = ... + network: technology_network, params: fanout_substitution_params | None = ... ) -> technology_network: ... def is_fanout_substituted(network: technology_network, params: fanout_substitution_params | None = ...) -> bool: ... @@ -782,7 +782,7 @@ class network_balancing_params: unify_outputs: bool def network_balancing( - network: technology_network, params: network_balancing_params | None = ... + network: technology_network, params: network_balancing_params | None = ... ) -> technology_network: ... def is_balanced(network: technology_network, params: network_balancing_params | None = ...) -> bool: ... @@ -817,40 +817,40 @@ def all_standard_2_input_functions() -> technology_mapping_params: ... def all_standard_3_input_functions() -> technology_mapping_params: ... def all_supported_standard_functions() -> technology_mapping_params: ... def technology_mapping( - network: technology_network, - params: technology_mapping_params | None = ..., - stats: technology_mapping_stats | None = None, + network: technology_network, + params: technology_mapping_params | None = ..., + stats: technology_mapping_stats | None = None, ) -> technology_network: ... ## path finding @overload def manhattan_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def manhattan_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @overload def euclidean_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> float: ... @overload def euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... @overload def squared_euclidean_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> float: ... @overload def squared_euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... @overload def twoddwave_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def twoddwave_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @overload def chebyshev_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def chebyshev_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @@ -862,22 +862,22 @@ class a_star_params: @overload def a_star( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - params: a_star_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + params: a_star_params | None = ..., ) -> list[offset_coordinate]: ... @overload def a_star( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - params: a_star_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + params: a_star_params | None = ..., ) -> list[cube_coordinate]: ... class enumerate_all_paths_params: @@ -887,22 +887,22 @@ class enumerate_all_paths_params: @overload def enumerate_all_paths( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - params: enumerate_all_paths_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + params: enumerate_all_paths_params | None = ..., ) -> list[list[offset_coordinate]]: ... @overload def enumerate_all_paths( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - params: enumerate_all_paths_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + params: enumerate_all_paths_params | None = ..., ) -> list[list[cube_coordinate]]: ... class yen_k_shortest_paths_params: @@ -912,24 +912,24 @@ class yen_k_shortest_paths_params: @overload def yen_k_shortest_paths( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - k: int, - params: yen_k_shortest_paths_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + k: int, + params: yen_k_shortest_paths_params | None = ..., ) -> list[list[offset_coordinate]]: ... @overload def yen_k_shortest_paths( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - k: int, - params: yen_k_shortest_paths_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + k: int, + params: yen_k_shortest_paths_params | None = ..., ) -> list[list[cube_coordinate]]: ... # physical design @@ -956,18 +956,18 @@ class color_routing_params: @overload def color_routing( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout, - objectives: list[tuple[offset_coordinate, offset_coordinate]], - params: color_routing_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout, + objectives: list[tuple[offset_coordinate, offset_coordinate]], + params: color_routing_params | None = ..., ) -> bool: ... @overload def color_routing( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout, - objectives: list[tuple[cube_coordinate, cube_coordinate]], - params: color_routing_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout, + objectives: list[tuple[cube_coordinate, cube_coordinate]], + params: color_routing_params | None = ..., ) -> bool: ... class technology_constraints(Enum): @@ -1005,13 +1005,13 @@ class exact_stats: def report(self) -> str: ... def exact_cartesian( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> cartesian_gate_layout: ... def exact_shifted_cartesian( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> shifted_cartesian_gate_layout: ... def exact_hexagonal( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> hexagonal_gate_layout: ... class gold_effort_mode(Enum): @@ -1050,9 +1050,9 @@ class graph_oriented_layout_design_stats: def report(self) -> str: ... def graph_oriented_layout_design( - network: technology_network, - parameters: graph_oriented_layout_design_params | None = ..., - statistics: graph_oriented_layout_design_stats | None = None, + network: technology_network, + parameters: graph_oriented_layout_design_params | None = ..., + statistics: graph_oriented_layout_design_stats | None = None, ) -> cartesian_gate_layout: ... class hexagonalization_stats: @@ -1062,7 +1062,7 @@ class hexagonalization_stats: def report(self) -> str: ... def hexagonalization( - layout: cartesian_gate_layout, statistics: hexagonalization_stats | None = None + layout: cartesian_gate_layout, statistics: hexagonalization_stats | None = None ) -> hexagonal_gate_layout: ... class orthogonal_params: @@ -1080,7 +1080,7 @@ class orthogonal_stats: def report(self) -> None: ... def orthogonal( - network: technology_network, parameters: orthogonal_params | None = ..., statistics: orthogonal_stats | None = None + network: technology_network, parameters: orthogonal_params | None = ..., statistics: orthogonal_stats | None = None ) -> cartesian_gate_layout: ... class post_layout_optimization_params: @@ -1107,9 +1107,9 @@ class post_layout_optimization_stats: def report(self) -> str: ... def post_layout_optimization( - layout: cartesian_gate_layout, - parameters: post_layout_optimization_params | None = ..., - statistics: post_layout_optimization_stats | None = None, + layout: cartesian_gate_layout, + parameters: post_layout_optimization_params | None = ..., + statistics: post_layout_optimization_stats | None = None, ) -> cartesian_gate_layout: ... class wiring_reduction_params: @@ -1132,15 +1132,15 @@ class wiring_reduction_stats: def report(self) -> str: ... def wiring_reduction( - layout: cartesian_gate_layout, - parameters: wiring_reduction_params | None = ..., - statistics: wiring_reduction_stats | None = None, + layout: cartesian_gate_layout, + parameters: wiring_reduction_params | None = ..., + statistics: wiring_reduction_stats | None = None, ) -> cartesian_gate_layout: ... # properties def critical_path_length_and_throughput( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, ) -> tuple[int, int]: ... # TODO design_sidb_gates @@ -1162,10 +1162,10 @@ class design_sidb_gates_params: number_of_sidbs: int def design_sidb_gates( - skeleton: sidb_100_lattice | sidb_111_lattice, - spec: [[int, int], int], - params: design_sidb_gates_params = ..., - stats: design_sidb_gates_stats | None = None, + skeleton: sidb_100_lattice | sidb_111_lattice, + spec: [[int, int], int], + params: design_sidb_gates_params = ..., + stats: design_sidb_gates_stats | None = None, ) -> list[sidb_100_lattice | sidb_111_lattice]: ... ## simulation @@ -1176,7 +1176,7 @@ def design_sidb_gates( def simulate(network: technology_network) -> dict[str, list[bool]]: ... @overload def simulate( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, ) -> dict[str, list[bool]]: ... ### sidb @@ -1200,9 +1200,9 @@ class gate_level_drv_params: border_io: bool def gate_level_drvs( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - params: gate_level_drv_params | None = ..., - print_report: bool | None = False, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + params: gate_level_drv_params | None = ..., + print_report: bool | None = False, ) -> tuple[int, int]: ... class eq_type(Enum): @@ -1221,9 +1221,9 @@ class equivalence_checking_stats: runtime: float def equivalence_checking( - specification: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - implementation: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - statistics: equivalence_checking_stats | None = None, + specification: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + implementation: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + statistics: equivalence_checking_stats | None = None, ) -> eq_type: ... # In/Out @@ -1244,10 +1244,10 @@ def read_fqca_layout(filename: str, layout_name: str = "") -> qca_layout: ... def write_dot_network(network: technology_network, filename: str) -> None: ... def write_dot_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str ) -> None: ... def write_fgl_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str ) -> None: ... class out_of_cell_names_exception(IndexError): ... @@ -1258,9 +1258,9 @@ class write_fqca_layout_params: create_inter_layer_via_cells: bool def write_fqca_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - filename: str, - params: write_fqca_layout_params | None = ..., + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + filename: str, + params: write_fqca_layout_params | None = ..., ) -> None: ... # TODO write_operational_domain @@ -1274,8 +1274,8 @@ def write_qca_layout(layout: qca_layout, filename: str, params: write_qca_layout def write_qcc_layout(layout: inml_layout, filename: str) -> None: ... def write_qll_layout(layout: qca_layout | inml_layout, filename: str) -> None: ... def write_sqd_layout( - layout: sidb_111_lattice | sidb_100_lattice | sidb_layout, - filename: str, + layout: sidb_111_lattice | sidb_100_lattice | sidb_layout, + filename: str, ) -> None: ... def write_sqd_sim_result(layout: sidb_layout, filename: str) -> None: ... @@ -1287,7 +1287,7 @@ def area(layout: qca_layout, width: int = 18, height: int = 18, hspace: int = 2, def area(layout: inml_layout, width: int = 50, height: int = 100, hspace: int = 10, vspace: int = 25) -> float: ... @overload def area( - layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, vspace: float = 0.384 + layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, vspace: float = 0.384 ) -> float: ... # TODO all SiDB technology @@ -1337,9 +1337,9 @@ class detect_bdl_pairs_params: self.maximum_distance: float def detect_bdl_pairs( - lyt: sidb_100_lattice | sidb_111_lattice, - type: sidb_technology.cell_type | None = None, - params: detect_bdl_pairs_params = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + type: sidb_technology.cell_type | None = None, + params: detect_bdl_pairs_params = ..., ) -> list[bdl_pair]: ... class sidb_defect_type(Enum): @@ -1360,11 +1360,11 @@ class sidb_defect_type(Enum): class sidb_defect: def __init__( - self, - defect_type: sidb_defect_type = ..., - electric_charge: int = 0, - relative_permittivity: float = 0.0, - screening_distance: float = 0.0, + self, + defect_type: sidb_defect_type = ..., + electric_charge: int = 0, + relative_permittivity: float = 0.0, + screening_distance: float = 0.0, ) -> None: def __eq__(self, rhs: sidb_defect) -> bool: ... def __ne__(self, rhs: sidb_defect) -> bool: ... @@ -1380,9 +1380,9 @@ def is_positively_charged_defect(defect: sidb_defect_type) -> bool: ... def is_negatively_charged_defect(defect: sidb_defect_type) -> bool: ... def is_neutrally_charged_defect(defect: sidb_defect_type) -> bool: ... def defect_extent( - defect: sidb_defect_type, - charged_defect_spacing_overwrite: float | None = None, - neutral_defect_spacing_overwrite: float | None = None, + defect: sidb_defect_type, + charged_defect_spacing_overwrite: float | None = None, + neutral_defect_spacing_overwrite: float | None = None, ) -> float: ... class sidb_charge_state(Enum): @@ -1429,10 +1429,10 @@ class charge_distribution_surface_100(sidb_100_lattice): def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( - self, - lyt: charge_distribution_surface_100, - params: sidb_simulation_parameters = ..., - cs: sidb_charge_state = ..., + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., ) -> None: ... @overload def __init__(self, lyt: charge_distribution_surface_100) -> None: ... @@ -1443,7 +1443,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def charge_exists(self, cs: sidb_charge_state) -> bool: ... def cell_to_index(self, c: offset_coordinate) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... @@ -1452,7 +1452,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... def erase_defect(self, c: offset_coordinate) -> None: ... def assign_charge_state_by_cell_index( - self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... @@ -1472,10 +1472,10 @@ class charge_distribution_surface_100(sidb_100_lattice): def recompute_system_energy(self) -> None: ... def get_system_energy(self) -> float: ... def update_after_charge_change( - self, - dep_cell: dependent_cell_mode = ..., - energy_calculation_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def validity_check(self) -> bool: ... def is_physically_valid(self) -> bool: ... @@ -1483,17 +1483,17 @@ class charge_distribution_surface_100(sidb_100_lattice): def charge_distribution_to_index(self) -> int: ... def get_charge_index_and_base(self) -> tuple[int, int]: ... def increase_charge_index_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( - self, potential_value: float, dependent_cell: dependent_cell_mode = ... + self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... @@ -1504,7 +1504,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... def chargeless_potential_at_given_distance(self, distance: float) -> float: ... def chargeless_potential_generated_by_defect_at_given_distance( - self, distance: float, defect: sidb_defect + self, distance: float, defect: sidb_defect ) -> float: ... def assign_local_external_potential(self, external_potential: float) -> None: ... def get_local_external_potentials(self) -> list[float]: ... @@ -1514,19 +1514,19 @@ class charge_distribution_surface_100(sidb_100_lattice): def get_charge_index_of_sub_layout(self) -> int: ... def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... def increase_charge_index_of_sub_layout_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def assign_charge_index_by_gray_code( - self, - current_gray_code: int, - previous_gray_code: int, - dependent_cell: dependent_cell_mode = ..., - energy_calc_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def reset_charge_index_sub_layout(self) -> None: ... def get_max_charge_index_sub_layout(self) -> int: ... @@ -1543,10 +1543,10 @@ class charge_distribution_surface_111(sidb_111_lattice): def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( - self, - lyt: charge_distribution_surface_100, - params: sidb_simulation_parameters = ..., - cs: sidb_charge_state = ..., + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., ) -> None: ... @overload def __init__(self, lyt: charge_distribution_surface_100) -> None: ... @@ -1557,7 +1557,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def charge_exists(self, cs: sidb_charge_state) -> bool: ... def cell_to_index(self, c: offset_coordinate) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... @@ -1566,7 +1566,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... def erase_defect(self, c: offset_coordinate) -> None: ... def assign_charge_state_by_cell_index( - self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... @@ -1586,10 +1586,10 @@ class charge_distribution_surface_111(sidb_111_lattice): def recompute_system_energy(self) -> None: ... def get_system_energy(self) -> float: ... def update_after_charge_change( - self, - dep_cell: dependent_cell_mode = ..., - energy_calculation_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def validity_check(self) -> bool: ... def is_physically_valid(self) -> bool: ... @@ -1597,17 +1597,17 @@ class charge_distribution_surface_111(sidb_111_lattice): def charge_distribution_to_index(self) -> int: ... def get_charge_index_and_base(self) -> tuple[int, int]: ... def increase_charge_index_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( - self, potential_value: float, dependent_cell: dependent_cell_mode = ... + self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... @@ -1618,7 +1618,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... def chargeless_potential_at_given_distance(self, distance: float) -> float: ... def chargeless_potential_generated_by_defect_at_given_distance( - self, distance: float, defect: sidb_defect + self, distance: float, defect: sidb_defect ) -> float: ... def assign_local_external_potential(self, external_potential: float) -> None: ... def get_local_external_potentials(self) -> list[float]: ... @@ -1628,19 +1628,19 @@ class charge_distribution_surface_111(sidb_111_lattice): def get_charge_index_of_sub_layout(self) -> int: ... def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... def increase_charge_index_of_sub_layout_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def assign_charge_index_by_gray_code( - self, - current_gray_code: int, - previous_gray_code: int, - dependent_cell: dependent_cell_mode = ..., - energy_calc_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def reset_charge_index_sub_layout(self) -> None: ... def get_max_charge_index_sub_layout(self) -> int: ... @@ -1657,10 +1657,10 @@ class charge_distribution_surface(sidb_layout): def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( - self, - lyt: charge_distribution_surface_100, - params: sidb_simulation_parameters = ..., - cs: sidb_charge_state = ..., + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., ) -> None: ... @overload def __init__(self, lyt: charge_distribution_surface_100) -> None: ... @@ -1671,7 +1671,7 @@ class charge_distribution_surface(sidb_layout): def charge_exists(self, cs: sidb_charge_state) -> bool: ... def cell_to_index(self, c: offset_coordinate) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... @@ -1680,7 +1680,7 @@ class charge_distribution_surface(sidb_layout): def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... def erase_defect(self, c: offset_coordinate) -> None: ... def assign_charge_state_by_cell_index( - self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... @@ -1700,10 +1700,10 @@ class charge_distribution_surface(sidb_layout): def recompute_system_energy(self) -> None: ... def get_system_energy(self) -> float: ... def update_after_charge_change( - self, - dep_cell: dependent_cell_mode = ..., - energy_calculation_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def validity_check(self) -> bool: ... def is_physically_valid(self) -> bool: ... @@ -1711,17 +1711,17 @@ class charge_distribution_surface(sidb_layout): def charge_distribution_to_index(self) -> int: ... def get_charge_index_and_base(self) -> tuple[int, int]: ... def increase_charge_index_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( - self, potential_value: float, dependent_cell: dependent_cell_mode = ... + self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... @@ -1732,7 +1732,7 @@ class charge_distribution_surface(sidb_layout): def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... def chargeless_potential_at_given_distance(self, distance: float) -> float: ... def chargeless_potential_generated_by_defect_at_given_distance( - self, distance: float, defect: sidb_defect + self, distance: float, defect: sidb_defect ) -> float: ... def assign_local_external_potential(self, external_potential: float) -> None: ... def get_local_external_potentials(self) -> list[float]: ... @@ -1742,19 +1742,19 @@ class charge_distribution_surface(sidb_layout): def get_charge_index_of_sub_layout(self) -> int: ... def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... def increase_charge_index_of_sub_layout_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def assign_charge_index_by_gray_code( - self, - current_gray_code: int, - previous_gray_code: int, - dependent_cell: dependent_cell_mode = ..., - energy_calc_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def reset_charge_index_sub_layout(self) -> None: ... def get_max_charge_index_sub_layout(self) -> int: ... @@ -1778,18 +1778,18 @@ class exact_sidb_simulation_engine(Enum): @overload def sidb_nm_position( - lyt: charge_distribution_surface | sidb_layout | sidb_100_lattice | sidb_111_lattice, c: sidb_technology.cell_type + lyt: charge_distribution_surface | sidb_layout | sidb_100_lattice | sidb_111_lattice, c: sidb_technology.cell_type ) -> None: ... @overload def sidb_nm_distance_111(lyt: sidb_111_lattice, c: sidb_technology.cell_type) -> None: ... class sidb_simulation_parameters: def __init__( - self, - base_number: int = 3, - mu_minus: float = -0.32, - relative_permittivity: float = 5.6, - screening_distance: float = 5.0, + self, + base_number: int = 3, + mu_minus: float = -0.32, + relative_permittivity: float = 5.6, + screening_distance: float = 5.0, ) -> None: ... def k(self) -> float: ... def mu_plus(self) -> float: ... @@ -1821,10 +1821,10 @@ class assess_physical_population_stability_params: precision_for_distance_corresponding_to_potential: float def assess_physical_population_stability_100( - lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... + lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... ) -> list[population_stability_information]: ... def assess_physical_population_stability_111( - lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... + lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... ) -> list[population_stability_information]: ... def energy_distribution(input_vec: list[charge_distribution_surface]) -> dict[float, int]: ... @@ -1856,10 +1856,10 @@ class detect_bdl_wires_params: bdl_pairs_params: object def detect_bdl_wires_100( - lyt: sidb_100_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... + lyt: sidb_100_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... ) -> list[bdl_wire_100]: ... def detect_bdl_wires_111( - lyt: sidb_111_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... + lyt: sidb_111_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... ) -> list[bdl_wire_111]: ... # Enums @@ -1884,43 +1884,43 @@ class is_operational_params: @overload def is_operational( - lyt: sidb_100_lattice, - spec: object, - params: is_operational_params = ..., - input_bdl_wire: bdl_wire_100 | None = None, - output_bdl_wire: bdl_wire_100 | None = None, + lyt: sidb_100_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: bdl_wire_100 | None = None, + output_bdl_wire: bdl_wire_100 | None = None, ) -> operational_status: ... @overload def is_operational( - lyt: sidb_100_lattice, - spec: object, - params: is_operational_params = ..., - input_bdl_wire: bdl_wire_111 | None = None, - output_bdl_wire: bdl_wire_111 | None = None, + lyt: sidb_100_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: bdl_wire_111 | None = None, + output_bdl_wire: bdl_wire_111 | None = None, ) -> operational_status: ... @overload def operational_input_patterns( - lyt: sidb_100_lattice, - spec: object, # Type depends on the specification - params: is_operational_params = ..., + lyt: sidb_100_lattice, + spec: object, # Type depends on the specification + params: is_operational_params = ..., ) -> list[int]: ... @overload def operational_input_patterns( - lyt: sidb_111_lattice, - spec: object, # Type depends on the specification - params: is_operational_params = ..., + lyt: sidb_111_lattice, + spec: object, # Type depends on the specification + params: is_operational_params = ..., ) -> list[int]: ... def is_kink_induced_non_operational( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: object, - params: is_operational_params = ..., - input_bdl_wire: object | None = None, - output_bdl_wire: object | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: object | None = None, + output_bdl_wire: object | None = None, ) -> operational_status: ... def kink_induced_non_operational_input_patterns( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: object, - params: is_operational_params = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + spec: object, + params: is_operational_params = ..., ) -> object: ... # QuickExact @@ -1963,15 +1963,15 @@ class critical_temperature_params: max_temperature: float def critical_temperature_gate_based( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - params: critical_temperature_params | None = ..., - stats: critical_temperature_stats | None = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + params: critical_temperature_params | None = ..., + stats: critical_temperature_stats | None = ..., ) -> float | None: ... def critical_temperature_non_gate_based( - lyt: sidb_100_lattice | sidb_111_lattice, - params: critical_temperature_params | None = ..., - stats: critical_temperature_stats | None = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + params: critical_temperature_params | None = ..., + stats: critical_temperature_stats | None = ..., ) -> float | None: ... class parameter_point: @@ -1989,7 +1989,7 @@ class sweep_parameter(Enum): class operational_domain_value_range: def __init__( - self, dimension: sweep_parameter, min: float | None = None, max: float | None = None, step: float | None = None + self, dimension: sweep_parameter, min: float | None = None, max: float | None = None, step: float | None = None ) -> None: ... dimension: sweep_parameter @@ -2021,31 +2021,31 @@ class operational_domain: def get_value(self, point: parameter_point) -> str: ... def operational_domain_grid_search( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... def operational_domain_random_sampling( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - samples: int, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... def operational_domain_flood_fill( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - samples: int, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... def operational_domain_contour_tracing( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - samples: int, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... # Utils From 7ebf04ba7a3302eb1723ffe5a0bda342ada2dbcd Mon Sep 17 00:00:00 2001 From: Drewniok Date: Tue, 10 Dec 2024 08:31:21 +0100 Subject: [PATCH 36/42] :art: add more functions to pyi. --- bindings/mnt/pyfiction/__init__.py | 36 +- .../determine_physically_valid_parameters.hpp | 12 +- .../sidb/displacement_robustness_domain.hpp | 2 +- ...cupation_probability_of_excited_states.hpp | 1 - .../include/pyfiction/utils/layout_utils.hpp | 87 +- bindings/mnt/pyfiction/pyfiction.pyi | 867 ++++++++++++------ docs/algorithms/sidb_simulation.rst | 2 + 7 files changed, 630 insertions(+), 377 deletions(-) diff --git a/bindings/mnt/pyfiction/__init__.py b/bindings/mnt/pyfiction/__init__.py index 610676b5b..0a5fb1848 100644 --- a/bindings/mnt/pyfiction/__init__.py +++ b/bindings/mnt/pyfiction/__init__.py @@ -34,8 +34,10 @@ ## physical_design apply_qca_one_library, apply_topolinano_library, - # Technology area, + assess_physical_population_stability_100, + assess_physical_population_stability_111, + # Technology assess_physical_population_stability_params, automatic_base_number_detection, bdl_input_iterator_100, @@ -70,7 +72,6 @@ color_routing_params, compute_operational_ratio, compute_operational_ratio_params, - convert_layout_to_siqad_coordinates, convert_potential_to_distance, create_and3_tt, create_and_tt, @@ -104,9 +105,7 @@ critical_temperature_non_gate_based, critical_temperature_params, critical_temperature_stats, - cube_area, cube_coordinate, - cube_volume, defect_extent, dependent_cell_mode, design_sidb_gates, @@ -151,9 +150,6 @@ ## verfication gate_level_drv_params, gate_level_drvs, - generate_multiple_random_sidb_layouts, - generate_random_sidb_layout, - generate_random_sidb_layout_params, get_name, gold_cost_objective, gold_effort_mode, @@ -196,9 +192,7 @@ num_adjacent_coordinates, occupation_probability_gate_based, occupation_probability_non_gate_based, - offset_area, offset_coordinate, - offset_volume, operational_condition, operational_domain, operational_domain_contour_tracing, @@ -218,7 +212,6 @@ physically_valid_parameters_domain, place, population_stability_information, - positive_charges, post_layout_optimization, post_layout_optimization_params, post_layout_optimization_stats, @@ -262,9 +255,7 @@ sign_to_charge_state, ### logic simulate, - siqad_area, siqad_coordinate, - siqad_volume, sqd_parsing_error, squared_euclidean_distance, ## network_transformation @@ -290,6 +281,7 @@ undefined_cell_label_exception, unrecognized_cell_definition_exception, unsupported_character_exception, + volume, wiring_reduction, wiring_reduction_params, wiring_reduction_stats, @@ -335,7 +327,8 @@ "apply_topolinano_library", # Technology "area", - "assess_physical_population_stability", + "assess_physical_population_stability_100", + "assess_physical_population_stability_111", "assess_physical_population_stability_params", "automatic_base_number_detection", "bdl_input_iterator_100", @@ -370,7 +363,6 @@ "color_routing_params", "compute_operational_ratio", "compute_operational_ratio_params", - "convert_layout_to_siqad_coordinates", "convert_potential_to_distance", "create_and3_tt", "create_and_tt", @@ -404,9 +396,7 @@ "critical_temperature_non_gate_based", "critical_temperature_params", "critical_temperature_stats", - "cube_area", "cube_coordinate", - "cube_volume", "defect_extent", "dependent_cell_mode", "design_sidb_gates", @@ -451,9 +441,6 @@ ## verfication "gate_level_drv_params", "gate_level_drvs", - "generate_multiple_random_sidb_layouts", - "generate_random_sidb_layout", - "generate_random_sidb_layout_params", "get_name", "gold_cost_objective", "gold_effort_mode", @@ -476,6 +463,7 @@ "is_charged_defect_type", "is_crossable_wire", "is_fanout_substituted", + set_name, "is_ground_state", "is_kink_induced_non_operational", "is_negatively_charged_defect", @@ -496,9 +484,7 @@ "num_adjacent_coordinates", "occupation_probability_gate_based", "occupation_probability_non_gate_based", - "offset_area", "offset_coordinate", - "offset_volume", "operational_condition", "operational_domain", "operational_domain_contour_tracing", @@ -518,7 +504,6 @@ "physically_valid_parameters_domain", "place", "population_stability_information", - "positive_charges", "post_layout_optimization", "post_layout_optimization_params", "post_layout_optimization_stats", @@ -540,7 +525,6 @@ "route_path", # "write_location_and_ground_state", "sample_writing_mode", - "set_name", "shifted_cartesian_gate_layout", "shifted_cartesian_layout", "shifted_cartesian_obstruction_layout", @@ -549,7 +533,6 @@ "sidb_charge_state", "sidb_defect", "sidb_defect_type", - "sidb_lattice_mode", "sidb_layout", "sidb_nm_distance_100", "sidb_nm_distance_111", @@ -562,9 +545,9 @@ "sign_to_charge_state", ### logic "simulate", - "siqad_area", + "area", "siqad_coordinate", - "siqad_volume", + "volume", "sqd_parsing_error", "squared_euclidean_distance", ## network_transformation @@ -613,4 +596,5 @@ "write_sqd_sim_result", "yen_k_shortest_paths", "yen_k_shortest_paths_params", + "sidb_lattice_mode", ] diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp index d2cace689..06356c19c 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp @@ -14,12 +14,18 @@ #include #include +#include + +#include << stdexcept> + namespace pyfiction { namespace detail { +// TODO update docu + template void determine_physically_valid_parameters(pybind11::module& m) { @@ -35,12 +41,10 @@ inline void determine_physically_valid_parameters(pybind11::module& m) { namespace py = pybind11; - py::class_>(m, "physically_valid_parameters_domain", - DOC(fiction_operational_domain)) - // todo add docu + py::class_>( + m, "physically_valid_parameters_domain", DOC(fiction_determine_physically_valid_parameters)) .def(py::init<>()) .def_readwrite("dimensions", &fiction::operational_domain::dimensions) - .def( "get_excited_state_number_for_parameter", [](const fiction::operational_domain& domain, diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp index ed491e746..c8c25ad5c 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp @@ -68,7 +68,7 @@ inline void determine_displacement_robustness_domain(pybind11::module& m) .def_readwrite( "displacement_variations", &fiction::displacement_robustness_domain_params::displacement_variations) - .def_readwrite("operational_params", + .def_readwrite("is_operational_params", &fiction::displacement_robustness_domain_params::operational_params) .def_readwrite("fixed_sidbs", &fiction::displacement_robustness_domain_params::fixed_sidbs) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/occupation_probability_of_excited_states.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/occupation_probability_of_excited_states.hpp index 26c61bbc9..adb7e42b1 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/occupation_probability_of_excited_states.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/occupation_probability_of_excited_states.hpp @@ -6,7 +6,6 @@ #define PYFICTION_OCCUPATION_PROBABILITY_OF_EXCITED_STATES_HPP #include "pyfiction/documentation.hpp" -#include "pyfiction/types.hpp" #include diff --git a/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp b/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp index bf3777f58..8dd9bc6c9 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp @@ -1,92 +1,25 @@ // -// Created by marcel on 21.11.23. +// Created by Jan Drewniok on 11.11.24. // -#ifndef PYFICTION_LAYOUT_UTILS_HPP -#define PYFICTION_LAYOUT_UTILS_HPP +#ifndef PYFICTION_VERSION_INFO_HPP +#define PYFICTION_VERSION_INFO_HPP -#include "pyfiction/documentation.hpp" -#include "pyfiction/types.hpp" - -#include +#include #include -#include - -#include namespace pyfiction { -namespace detail -{ - -template -void num_adjacent_coordinates(pybind11::module& m) +inline void version_info(pybind11::module& m) { - namespace py = pybind11; - - m.def("num_adjacent_coordinates", &fiction::num_adjacent_coordinates, py::arg("lyt"), py::arg("c"), - DOC(fiction_num_adjacent_coordinates)); -} - -template -void normalize_layout_coordinates(pybind11::module& m) -{ - namespace py = pybind11; - - m.def("normalize_layout_coordinates", &fiction::normalize_layout_coordinates, py::arg("lyt"), - DOC(fiction_normalize_layout_coordinates)); -} - -template -void convert_to_siqad_coordinates(pybind11::module& m) -{ - namespace py = pybind11; - - m.def("convert_layout_to_siqad_coordinates", &fiction::convert_layout_to_siqad_coordinates, py::arg("lyt"), - DOC(fiction_convert_layout_to_siqad_coordinates)); -} - -template -void random_coordinate(pybind11::module& m) -{ - namespace py = pybind11; - - m.def("random_coordinate", &fiction::random_coordinate>, py::arg("coordinate1"), - py::arg("coordinate_2"), DOC(fiction_random_coordinate)); -} - -} // namespace detail - -inline void layout_utils(pybind11::module& m) -{ - // NOTE be careful with the order of the following calls! Python will resolve the first matching overload! - - detail::num_adjacent_coordinates(m); - detail::num_adjacent_coordinates(m); - detail::num_adjacent_coordinates(m); - detail::num_adjacent_coordinates(m); - detail::num_adjacent_coordinates(m); - detail::num_adjacent_coordinates(m); - - detail::normalize_layout_coordinates(m); - detail::normalize_layout_coordinates(m); - detail::normalize_layout_coordinates(m); - - detail::convert_to_siqad_coordinates(m); - - detail::random_coordinate(m); - detail::random_coordinate(m); - detail::random_coordinate(m); - detail::random_coordinate(m); - detail::random_coordinate(m); - detail::random_coordinate(m); - detail::random_coordinate(m); - detail::random_coordinate(m); - detail::random_coordinate(m); + m.attr("__version__") = fiction::FICTION_VERSION; + m.attr("__repo__") = fiction::FICTION_REPO; + m.attr("__compiled_date__") = fiction::COMPILED_DATE; + m.attr("__compiled_time__") = fiction::COMPILED_TIME; } } // namespace pyfiction -#endif // PYFICTION_LAYOUT_UTILS_HPP +#endif // PYFICTION_VERSION_INFO_HPP diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 70d0c6f5c..a31eb32cc 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1,5 +1,5 @@ from enum import Enum -from typing import Callable, overload +from typing import Any, Callable, overload # Layouts @@ -302,7 +302,7 @@ class cartesian_gate_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... @@ -321,6 +321,8 @@ class cartesian_gate_layout(clocked_cartesian_layout): def is_fanout(self) -> bool: ... def is_wire(self) -> bool: ... def set_layout_name(self, name: str) -> None: ... + + def set_name(self, name: str) -> None: ... def get_layout_name(self) -> str: ... def set_input_name(self, index: int, name: str) -> None: ... def get_input_name(self, index: int) -> str: ... @@ -388,7 +390,7 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... @@ -629,7 +631,7 @@ class qca_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: qca_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> qca_technology.cell_type: ... @@ -656,7 +658,7 @@ class inml_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: inml_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> inml_technology.cell_type: ... @@ -683,7 +685,7 @@ class sidb_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: sidb_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> sidb_technology.cell_type: ... @@ -772,7 +774,7 @@ class fanout_substitution_params: threshold: int | None def fanout_substitution( - network: technology_network, params: fanout_substitution_params | None = ... + network: technology_network, params: fanout_substitution_params | None = ... ) -> technology_network: ... def is_fanout_substituted(network: technology_network, params: fanout_substitution_params | None = ...) -> bool: ... @@ -782,7 +784,7 @@ class network_balancing_params: unify_outputs: bool def network_balancing( - network: technology_network, params: network_balancing_params | None = ... + network: technology_network, params: network_balancing_params | None = ... ) -> technology_network: ... def is_balanced(network: technology_network, params: network_balancing_params | None = ...) -> bool: ... @@ -817,40 +819,40 @@ def all_standard_2_input_functions() -> technology_mapping_params: ... def all_standard_3_input_functions() -> technology_mapping_params: ... def all_supported_standard_functions() -> technology_mapping_params: ... def technology_mapping( - network: technology_network, - params: technology_mapping_params | None = ..., - stats: technology_mapping_stats | None = None, + network: technology_network, + params: technology_mapping_params | None = ..., + stats: technology_mapping_stats | None = None, ) -> technology_network: ... ## path finding @overload def manhattan_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def manhattan_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @overload def euclidean_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> float: ... @overload def euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... @overload def squared_euclidean_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> float: ... @overload def squared_euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... @overload def twoddwave_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def twoddwave_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @overload def chebyshev_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def chebyshev_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @@ -862,22 +864,22 @@ class a_star_params: @overload def a_star( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - params: a_star_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + params: a_star_params | None = ..., ) -> list[offset_coordinate]: ... @overload def a_star( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - params: a_star_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + params: a_star_params | None = ..., ) -> list[cube_coordinate]: ... class enumerate_all_paths_params: @@ -887,22 +889,22 @@ class enumerate_all_paths_params: @overload def enumerate_all_paths( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - params: enumerate_all_paths_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + params: enumerate_all_paths_params | None = ..., ) -> list[list[offset_coordinate]]: ... @overload def enumerate_all_paths( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - params: enumerate_all_paths_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + params: enumerate_all_paths_params | None = ..., ) -> list[list[cube_coordinate]]: ... class yen_k_shortest_paths_params: @@ -912,24 +914,24 @@ class yen_k_shortest_paths_params: @overload def yen_k_shortest_paths( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - k: int, - params: yen_k_shortest_paths_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + k: int, + params: yen_k_shortest_paths_params | None = ..., ) -> list[list[offset_coordinate]]: ... @overload def yen_k_shortest_paths( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - k: int, - params: yen_k_shortest_paths_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + k: int, + params: yen_k_shortest_paths_params | None = ..., ) -> list[list[cube_coordinate]]: ... # physical design @@ -956,18 +958,18 @@ class color_routing_params: @overload def color_routing( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout, - objectives: list[tuple[offset_coordinate, offset_coordinate]], - params: color_routing_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout, + objectives: list[tuple[offset_coordinate, offset_coordinate]], + params: color_routing_params | None = ..., ) -> bool: ... @overload def color_routing( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout, - objectives: list[tuple[cube_coordinate, cube_coordinate]], - params: color_routing_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout, + objectives: list[tuple[cube_coordinate, cube_coordinate]], + params: color_routing_params | None = ..., ) -> bool: ... class technology_constraints(Enum): @@ -1005,13 +1007,13 @@ class exact_stats: def report(self) -> str: ... def exact_cartesian( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> cartesian_gate_layout: ... def exact_shifted_cartesian( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> shifted_cartesian_gate_layout: ... def exact_hexagonal( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> hexagonal_gate_layout: ... class gold_effort_mode(Enum): @@ -1050,9 +1052,9 @@ class graph_oriented_layout_design_stats: def report(self) -> str: ... def graph_oriented_layout_design( - network: technology_network, - parameters: graph_oriented_layout_design_params | None = ..., - statistics: graph_oriented_layout_design_stats | None = None, + network: technology_network, + parameters: graph_oriented_layout_design_params | None = ..., + statistics: graph_oriented_layout_design_stats | None = None, ) -> cartesian_gate_layout: ... class hexagonalization_stats: @@ -1062,7 +1064,7 @@ class hexagonalization_stats: def report(self) -> str: ... def hexagonalization( - layout: cartesian_gate_layout, statistics: hexagonalization_stats | None = None + layout: cartesian_gate_layout, statistics: hexagonalization_stats | None = None ) -> hexagonal_gate_layout: ... class orthogonal_params: @@ -1080,7 +1082,8 @@ class orthogonal_stats: def report(self) -> None: ... def orthogonal( - network: technology_network, parameters: orthogonal_params | None = ..., statistics: orthogonal_stats | None = None + network: technology_network, parameters: orthogonal_params | None = ..., + statistics: orthogonal_stats | None = None ) -> cartesian_gate_layout: ... class post_layout_optimization_params: @@ -1107,9 +1110,9 @@ class post_layout_optimization_stats: def report(self) -> str: ... def post_layout_optimization( - layout: cartesian_gate_layout, - parameters: post_layout_optimization_params | None = ..., - statistics: post_layout_optimization_stats | None = None, + layout: cartesian_gate_layout, + parameters: post_layout_optimization_params | None = ..., + statistics: post_layout_optimization_stats | None = None, ) -> cartesian_gate_layout: ... class wiring_reduction_params: @@ -1132,18 +1135,26 @@ class wiring_reduction_stats: def report(self) -> str: ... def wiring_reduction( - layout: cartesian_gate_layout, - parameters: wiring_reduction_params | None = ..., - statistics: wiring_reduction_stats | None = None, + layout: cartesian_gate_layout, + parameters: wiring_reduction_params | None = ..., + statistics: wiring_reduction_stats | None = None, ) -> cartesian_gate_layout: ... -# properties +def clear_routing( + lyt: cartesian_obstruction_layout + | cartesian_gate_layout + | shifted_cartesian_layout + | shifted_cartesian_gate_layout + | hexagonal_obstruction_layout + | hexagonal_gate_layout, +) -> None: ... def critical_path_length_and_throughput( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, ) -> tuple[int, int]: ... -# TODO design_sidb_gates + +# SidB Logic Design class design_sidb_gates_stats: def __init__(self) -> None: ... @@ -1162,10 +1173,10 @@ class design_sidb_gates_params: number_of_sidbs: int def design_sidb_gates( - skeleton: sidb_100_lattice | sidb_111_lattice, - spec: [[int, int], int], - params: design_sidb_gates_params = ..., - stats: design_sidb_gates_stats | None = None, + skeleton: sidb_100_lattice | sidb_111_lattice, + spec: [[int, int], int], + params: design_sidb_gates_params = ..., + stats: design_sidb_gates_stats | None = None, ) -> list[sidb_100_lattice | sidb_111_lattice]: ... ## simulation @@ -1176,13 +1187,9 @@ def design_sidb_gates( def simulate(network: technology_network) -> dict[str, list[bool]]: ... @overload def simulate( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, ) -> dict[str, list[bool]]: ... -### sidb - -# TODO all SiDB simulation - ## verification class gate_level_drv_params: @@ -1200,9 +1207,9 @@ class gate_level_drv_params: border_io: bool def gate_level_drvs( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - params: gate_level_drv_params | None = ..., - print_report: bool | None = False, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + params: gate_level_drv_params | None = ..., + print_report: bool | None = False, ) -> tuple[int, int]: ... class eq_type(Enum): @@ -1221,9 +1228,9 @@ class equivalence_checking_stats: runtime: float def equivalence_checking( - specification: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - implementation: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - statistics: equivalence_checking_stats | None = None, + specification: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + implementation: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + statistics: equivalence_checking_stats | None = None, ) -> eq_type: ... # In/Out @@ -1240,14 +1247,20 @@ class unrecognized_cell_definition_exception(Exception): ... def read_fqca_layout(filename: str, layout_name: str = "") -> qca_layout: ... -# TODO read_sqd_layout +class sqd_parsing_error(RuntimeError): ... + + +def read_sqd_layout_100(filename: str, layout_name: str = "") -> sidb_100_lattice: ... + + +def read_sqd_layout_111(filename: str, layout_name: str = "") -> sidb_111_lattice: ... def write_dot_network(network: technology_network, filename: str) -> None: ... def write_dot_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str ) -> None: ... def write_fgl_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str ) -> None: ... class out_of_cell_names_exception(IndexError): ... @@ -1258,24 +1271,80 @@ class write_fqca_layout_params: create_inter_layer_via_cells: bool def write_fqca_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - filename: str, - params: write_fqca_layout_params | None = ..., + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + filename: str, + params: write_fqca_layout_params | None = ..., +) -> None: ... + + +class sample_writing_mode(Enum): + ALL_SAMPLES: ... + OPERATIONAL_ONLY: ... + + +class write_operational_domain_params: + def __init__(self) -> None: + self.operational_tag: str + self.non_operational_tag: str + self.writing_mode: sample_writing_mode + + +def write_operational_domain( + opdom: operational_domain, filename: str, params: write_operational_domain_params | None = None +) -> None: ... + + +class color_mode(Enum): + """Enumeration for color modes in the SVG layout.""" + + LIGHT: int # Light mode for the layout colors + DARK: int # Dark mode for the layout colors + + +class sidb_lattice_mode(Enum): + SHOW_LATTICE: ... + HIDE_LATTICE: ... + + +class write_sidb_layout_svg_params: + def __init__(self) -> None: + self.lattice_point_size: float + self.sidb_size: float + self.sidb_border_width: float + self.color_background: str + self.color_mode: color_mode + self.lattice_mode: sidb_lattice_mode + + +class write_qca_layout_svg_params: + def __init__(self) -> None: ... + + +def write_sidb_layout_svg( + layout: sidb_100_lattice | sidb_111_lattice | sidb_layout, filename: str, + params: write_sidb_layout_svg_params = ... ) -> None: ... -# TODO write_operational_domain + +def write_sidb_layout_svg_to_string( + layout: sidb_100_lattice | sidb_111_lattice | sidb_layout, params: write_sidb_layout_svg_params = ... +) -> str: ... + + +def write_qca_layout_svg(layout: sidb_layout, filename: str, params: write_sidb_layout_svg_params = ...) -> None: ... class write_qca_layout_params: def __init__(self) -> None: ... create_inter_layer_via_cells: bool -def write_qca_layout(layout: qca_layout, filename: str, params: write_qca_layout_params | None = ...) -> None: ... + +def write_qca_layout(layout: qca_layout, filename: str, params: write_qca_layout_params = ...) -> None: ... def write_qcc_layout(layout: inml_layout, filename: str) -> None: ... def write_qll_layout(layout: qca_layout | inml_layout, filename: str) -> None: ... def write_sqd_layout( - layout: sidb_111_lattice | sidb_100_lattice | sidb_layout, - filename: str, + layout: sidb_111_lattice | sidb_100_lattice | sidb_layout, + filename: str, ) -> None: ... def write_sqd_sim_result(layout: sidb_layout, filename: str) -> None: ... @@ -1287,10 +1356,11 @@ def area(layout: qca_layout, width: int = 18, height: int = 18, hspace: int = 2, def area(layout: inml_layout, width: int = 50, height: int = 100, hspace: int = 10, vspace: int = 25) -> float: ... @overload def area( - layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, vspace: float = 0.384 + layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, vspace: float = 0.384 ) -> float: ... -# TODO all SiDB technology + +# SiDB Technology class input_bdl_configuration(Enum): PERTURBER_ABSENCE_ENCODED: ... @@ -1337,9 +1407,9 @@ class detect_bdl_pairs_params: self.maximum_distance: float def detect_bdl_pairs( - lyt: sidb_100_lattice | sidb_111_lattice, - type: sidb_technology.cell_type | None = None, - params: detect_bdl_pairs_params = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + type: sidb_technology.cell_type | None = None, + params: detect_bdl_pairs_params = ..., ) -> list[bdl_pair]: ... class sidb_defect_type(Enum): @@ -1360,11 +1430,11 @@ class sidb_defect_type(Enum): class sidb_defect: def __init__( - self, - defect_type: sidb_defect_type = ..., - electric_charge: int = 0, - relative_permittivity: float = 0.0, - screening_distance: float = 0.0, + self, + defect_type: sidb_defect_type = ..., + electric_charge: int = 0, + relative_permittivity: float = 0.0, + screening_distance: float = 0.0, ) -> None: def __eq__(self, rhs: sidb_defect) -> bool: ... def __ne__(self, rhs: sidb_defect) -> bool: ... @@ -1380,9 +1450,9 @@ def is_positively_charged_defect(defect: sidb_defect_type) -> bool: ... def is_negatively_charged_defect(defect: sidb_defect_type) -> bool: ... def is_neutrally_charged_defect(defect: sidb_defect_type) -> bool: ... def defect_extent( - defect: sidb_defect_type, - charged_defect_spacing_overwrite: float | None = None, - neutral_defect_spacing_overwrite: float | None = None, + defect: sidb_defect_type, + charged_defect_spacing_overwrite: float | None = None, + neutral_defect_spacing_overwrite: float | None = None, ) -> float: ... class sidb_charge_state(Enum): @@ -1429,10 +1499,10 @@ class charge_distribution_surface_100(sidb_100_lattice): def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( - self, - lyt: charge_distribution_surface_100, - params: sidb_simulation_parameters = ..., - cs: sidb_charge_state = ..., + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., ) -> None: ... @overload def __init__(self, lyt: charge_distribution_surface_100) -> None: ... @@ -1443,7 +1513,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def charge_exists(self, cs: sidb_charge_state) -> bool: ... def cell_to_index(self, c: offset_coordinate) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... @@ -1452,7 +1522,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... def erase_defect(self, c: offset_coordinate) -> None: ... def assign_charge_state_by_cell_index( - self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... @@ -1472,10 +1542,10 @@ class charge_distribution_surface_100(sidb_100_lattice): def recompute_system_energy(self) -> None: ... def get_system_energy(self) -> float: ... def update_after_charge_change( - self, - dep_cell: dependent_cell_mode = ..., - energy_calculation_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def validity_check(self) -> bool: ... def is_physically_valid(self) -> bool: ... @@ -1483,17 +1553,17 @@ class charge_distribution_surface_100(sidb_100_lattice): def charge_distribution_to_index(self) -> int: ... def get_charge_index_and_base(self) -> tuple[int, int]: ... def increase_charge_index_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( - self, potential_value: float, dependent_cell: dependent_cell_mode = ... + self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... @@ -1504,7 +1574,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... def chargeless_potential_at_given_distance(self, distance: float) -> float: ... def chargeless_potential_generated_by_defect_at_given_distance( - self, distance: float, defect: sidb_defect + self, distance: float, defect: sidb_defect ) -> float: ... def assign_local_external_potential(self, external_potential: float) -> None: ... def get_local_external_potentials(self) -> list[float]: ... @@ -1514,19 +1584,19 @@ class charge_distribution_surface_100(sidb_100_lattice): def get_charge_index_of_sub_layout(self) -> int: ... def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... def increase_charge_index_of_sub_layout_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def assign_charge_index_by_gray_code( - self, - current_gray_code: int, - previous_gray_code: int, - dependent_cell: dependent_cell_mode = ..., - energy_calc_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def reset_charge_index_sub_layout(self) -> None: ... def get_max_charge_index_sub_layout(self) -> int: ... @@ -1543,10 +1613,10 @@ class charge_distribution_surface_111(sidb_111_lattice): def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( - self, - lyt: charge_distribution_surface_100, - params: sidb_simulation_parameters = ..., - cs: sidb_charge_state = ..., + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., ) -> None: ... @overload def __init__(self, lyt: charge_distribution_surface_100) -> None: ... @@ -1557,7 +1627,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def charge_exists(self, cs: sidb_charge_state) -> bool: ... def cell_to_index(self, c: offset_coordinate) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... @@ -1566,7 +1636,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... def erase_defect(self, c: offset_coordinate) -> None: ... def assign_charge_state_by_cell_index( - self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... @@ -1586,10 +1656,10 @@ class charge_distribution_surface_111(sidb_111_lattice): def recompute_system_energy(self) -> None: ... def get_system_energy(self) -> float: ... def update_after_charge_change( - self, - dep_cell: dependent_cell_mode = ..., - energy_calculation_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def validity_check(self) -> bool: ... def is_physically_valid(self) -> bool: ... @@ -1597,17 +1667,17 @@ class charge_distribution_surface_111(sidb_111_lattice): def charge_distribution_to_index(self) -> int: ... def get_charge_index_and_base(self) -> tuple[int, int]: ... def increase_charge_index_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( - self, potential_value: float, dependent_cell: dependent_cell_mode = ... + self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... @@ -1618,7 +1688,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... def chargeless_potential_at_given_distance(self, distance: float) -> float: ... def chargeless_potential_generated_by_defect_at_given_distance( - self, distance: float, defect: sidb_defect + self, distance: float, defect: sidb_defect ) -> float: ... def assign_local_external_potential(self, external_potential: float) -> None: ... def get_local_external_potentials(self) -> list[float]: ... @@ -1628,19 +1698,19 @@ class charge_distribution_surface_111(sidb_111_lattice): def get_charge_index_of_sub_layout(self) -> int: ... def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... def increase_charge_index_of_sub_layout_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def assign_charge_index_by_gray_code( - self, - current_gray_code: int, - previous_gray_code: int, - dependent_cell: dependent_cell_mode = ..., - energy_calc_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def reset_charge_index_sub_layout(self) -> None: ... def get_max_charge_index_sub_layout(self) -> int: ... @@ -1657,10 +1727,10 @@ class charge_distribution_surface(sidb_layout): def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( - self, - lyt: charge_distribution_surface_100, - params: sidb_simulation_parameters = ..., - cs: sidb_charge_state = ..., + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., ) -> None: ... @overload def __init__(self, lyt: charge_distribution_surface_100) -> None: ... @@ -1671,7 +1741,7 @@ class charge_distribution_surface(sidb_layout): def charge_exists(self, cs: sidb_charge_state) -> bool: ... def cell_to_index(self, c: offset_coordinate) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... @@ -1680,7 +1750,7 @@ class charge_distribution_surface(sidb_layout): def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... def erase_defect(self, c: offset_coordinate) -> None: ... def assign_charge_state_by_cell_index( - self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... @@ -1700,10 +1770,10 @@ class charge_distribution_surface(sidb_layout): def recompute_system_energy(self) -> None: ... def get_system_energy(self) -> float: ... def update_after_charge_change( - self, - dep_cell: dependent_cell_mode = ..., - energy_calculation_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def validity_check(self) -> bool: ... def is_physically_valid(self) -> bool: ... @@ -1711,17 +1781,17 @@ class charge_distribution_surface(sidb_layout): def charge_distribution_to_index(self) -> int: ... def get_charge_index_and_base(self) -> tuple[int, int]: ... def increase_charge_index_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( - self, potential_value: float, dependent_cell: dependent_cell_mode = ... + self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... @@ -1732,7 +1802,7 @@ class charge_distribution_surface(sidb_layout): def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... def chargeless_potential_at_given_distance(self, distance: float) -> float: ... def chargeless_potential_generated_by_defect_at_given_distance( - self, distance: float, defect: sidb_defect + self, distance: float, defect: sidb_defect ) -> float: ... def assign_local_external_potential(self, external_potential: float) -> None: ... def get_local_external_potentials(self) -> list[float]: ... @@ -1742,19 +1812,19 @@ class charge_distribution_surface(sidb_layout): def get_charge_index_of_sub_layout(self) -> int: ... def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... def increase_charge_index_of_sub_layout_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def assign_charge_index_by_gray_code( - self, - current_gray_code: int, - previous_gray_code: int, - dependent_cell: dependent_cell_mode = ..., - energy_calc_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def reset_charge_index_sub_layout(self) -> None: ... def get_max_charge_index_sub_layout(self) -> int: ... @@ -1767,6 +1837,22 @@ class charge_distribution_surface(sidb_layout): def is_within_bounds(self, c: tuple[int, int, int]) -> bool: ... def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... + +class sidb_simulation_parameters: + def __init__(self) -> None: ... + + +@overload +def exhaustive_ground_state_simulation( + lyt: sidb_100_lattice, params: sidb_simulation_parameters = ... +) -> sidb_simulation_result_100: ... + + +@overload +def exhaustive_ground_state_simulation( + lyt: sidb_111_lattice, params: sidb_simulation_parameters = ... +) -> sidb_simulation_result_111: ... + class sidb_simulation_engine(Enum): EXGS: ... QUICKSIM: ... @@ -1778,18 +1864,21 @@ class exact_sidb_simulation_engine(Enum): @overload def sidb_nm_position( - lyt: charge_distribution_surface | sidb_layout | sidb_100_lattice | sidb_111_lattice, c: sidb_technology.cell_type + lyt: charge_distribution_surface | sidb_layout | sidb_100_lattice | sidb_111_lattice, + c: sidb_technology.cell_type ) -> None: ... -@overload def sidb_nm_distance_111(lyt: sidb_111_lattice, c: sidb_technology.cell_type) -> None: ... + +def sidb_nm_distance_100(lyt: sidb_100_lattice, c: sidb_technology.cell_type) -> None: ... + class sidb_simulation_parameters: def __init__( - self, - base_number: int = 3, - mu_minus: float = -0.32, - relative_permittivity: float = 5.6, - screening_distance: float = 5.0, + self, + base_number: int = 3, + mu_minus: float = -0.32, + relative_permittivity: float = 5.6, + screening_distance: float = 5.0, ) -> None: ... def k(self) -> float: ... def mu_plus(self) -> float: ... @@ -1821,10 +1910,10 @@ class assess_physical_population_stability_params: precision_for_distance_corresponding_to_potential: float def assess_physical_population_stability_100( - lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... + lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... ) -> list[population_stability_information]: ... def assess_physical_population_stability_111( - lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... + lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... ) -> list[population_stability_information]: ... def energy_distribution(input_vec: list[charge_distribution_surface]) -> dict[float, int]: ... @@ -1856,10 +1945,10 @@ class detect_bdl_wires_params: bdl_pairs_params: object def detect_bdl_wires_100( - lyt: sidb_100_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... + lyt: sidb_100_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... ) -> list[bdl_wire_100]: ... def detect_bdl_wires_111( - lyt: sidb_111_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... + lyt: sidb_111_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... ) -> list[bdl_wire_111]: ... # Enums @@ -1884,43 +1973,43 @@ class is_operational_params: @overload def is_operational( - lyt: sidb_100_lattice, - spec: object, - params: is_operational_params = ..., - input_bdl_wire: bdl_wire_100 | None = None, - output_bdl_wire: bdl_wire_100 | None = None, + lyt: sidb_100_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: bdl_wire_100 | None = None, + output_bdl_wire: bdl_wire_100 | None = None, ) -> operational_status: ... @overload def is_operational( - lyt: sidb_100_lattice, - spec: object, - params: is_operational_params = ..., - input_bdl_wire: bdl_wire_111 | None = None, - output_bdl_wire: bdl_wire_111 | None = None, + lyt: sidb_100_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: bdl_wire_111 | None = None, + output_bdl_wire: bdl_wire_111 | None = None, ) -> operational_status: ... @overload def operational_input_patterns( - lyt: sidb_100_lattice, - spec: object, # Type depends on the specification - params: is_operational_params = ..., + lyt: sidb_100_lattice, + spec: object, # Type depends on the specification + params: is_operational_params = ..., ) -> list[int]: ... @overload def operational_input_patterns( - lyt: sidb_111_lattice, - spec: object, # Type depends on the specification - params: is_operational_params = ..., + lyt: sidb_111_lattice, + spec: object, # Type depends on the specification + params: is_operational_params = ..., ) -> list[int]: ... def is_kink_induced_non_operational( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: object, - params: is_operational_params = ..., - input_bdl_wire: object | None = None, - output_bdl_wire: object | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: object | None = None, + output_bdl_wire: object | None = None, ) -> operational_status: ... def kink_induced_non_operational_input_patterns( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: object, - params: is_operational_params = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + spec: object, + params: is_operational_params = ..., ) -> object: ... # QuickExact @@ -1963,15 +2052,15 @@ class critical_temperature_params: max_temperature: float def critical_temperature_gate_based( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - params: critical_temperature_params | None = ..., - stats: critical_temperature_stats | None = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + params: critical_temperature_params | None = ..., + stats: critical_temperature_stats | None = ..., ) -> float | None: ... def critical_temperature_non_gate_based( - lyt: sidb_100_lattice | sidb_111_lattice, - params: critical_temperature_params | None = ..., - stats: critical_temperature_stats | None = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + params: critical_temperature_params | None = ..., + stats: critical_temperature_stats | None = ..., ) -> float | None: ... class parameter_point: @@ -1989,7 +2078,8 @@ class sweep_parameter(Enum): class operational_domain_value_range: def __init__( - self, dimension: sweep_parameter, min: float | None = None, max: float | None = None, step: float | None = None + self, dimension: sweep_parameter, min: float | None = None, max: float | None = None, + step: float | None = None ) -> None: ... dimension: sweep_parameter @@ -2021,33 +2111,254 @@ class operational_domain: def get_value(self, point: parameter_point) -> str: ... def operational_domain_grid_search( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... def operational_domain_random_sampling( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - samples: int, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... def operational_domain_flood_fill( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - samples: int, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... def operational_domain_contour_tracing( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - samples: int, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... + +def calculate_energy_and_state_type_with_kinks_accepted( + sidb_energy_distribution: ..., valid_charge_distributions: ..., output_bdl_pairs: ..., spec: ..., + input_index: ... +) -> None: ... + + +def calculate_energy_and_state_type_with_kinks_rejected( + energy_distribution: ..., + valid_charge_distributions: ..., + spec: ..., + input_index: ..., + input_bdl_wires: ..., + output_bdl_wires: ..., +) -> None: ... + + +def can_positive_charges_occur( + lyt: sidb_100_lattice | sidb_111_lattice, + sim_params: sidb_simulation_parameters, +) -> bool: ... + + +@overload +def check_simulation_results_for_equivalence( + result1: sidb_simulation_result_100, + result2: sidb_simulation_result_100, +) -> bool: ... + + +@overload +def check_simulation_results_for_equivalence( + result1: sidb_simulation_result_111, + result2: sidb_simulation_result_111, +) -> bool: ... + + +class sidb_simulation_result_100: + def __init__(self) -> None: + self.algorithm_name: str + self.simulation_runtime: float + self.charge_distributions: list[charge_distribution_surface_100] + self.simulation_parameters: sidb_simulation_parameters + self.additional_simulation_parameters: dict[str, Any] + + algorithm_name: str + simulation_runtime: float + charge_distributions: list[charge_distribution_surface_100] + simulation_parameters: sidb_simulation_parameters + additional_simulation_parameters: dict[str, Any] + + +class sidb_simulation_result_111: + def __init__(self) -> None: + self.algorithm_name: str + self.simulation_runtime: float + self.charge_distributions: list[charge_distribution_surface_111] + self.simulation_parameters: sidb_simulation_parameters + self.additional_simulation_parameters: dict[str, Any] + + algorithm_name: str + simulation_runtime: float + charge_distributions: list[charge_distribution_surface_111] + simulation_parameters: sidb_simulation_parameters + additional_simulation_parameters: dict[str, Any] + + +class time_to_solution_params: + def __init__(self) -> None: + self.engine: str + self.repetitions: int + self.confidence_level: float + + +class time_to_solution_stats: + def __init__(self) -> None: + self.time_to_solution: float + self.acc: float + self.mean_single_runtime: float + self.single_runtime_exact: float + self.algorithm: str + + def report(self, stream: str | None = None) -> None: ... + + +def time_to_solution( + lyt: sidb_100_lattice | sidb_111_lattice, + quickim_params: quicksim_params, + tts_params: time_to_solution_params = ..., + ps: time_to_solution_stats | None = None, +) -> time_to_solution_stats: ... + + +def time_to_solution_for_given_simulation_results( + results_exact: sidb_simulation_result_100 | sidb_simulation_result_111, + results_heuristic: list[sidb_simulation_result_100 | sidb_simulation_result_111], + confidence_level: float = 0.997, + ps: time_to_solution_stats | None = None, +) -> time_to_solution_stats: ... + + +@overload +def is_ground_state( + heuristic_results: sidb_simulation_result_100, + exhaustive_results: sidb_simulation_result_100, +) -> bool: ... + + +@overload +def is_ground_state( + heuristic_results: sidb_simulation_result_111, + exhaustive_results: sidb_simulation_result_111, +) -> bool: ... + + +class displacement_analysis_mode(Enum): + EXHAUSTIVE = 0 + RANDOM = 1 + + +class dimer_displacement_policy(Enum): + STAY_ON_ORIGINAL_DIMER = 0 + ALLOW_OTHER_DIMER = 1 + + +class displacement_robustness_domain_params: + def __init__(self) -> None: + self.analysis_mode: displacement_analysis_mode + self.percentage_of_analyzed_displaced_layouts: float + self.displacement_variations: int + self.operational_params: is_operational_params + self.fixed_sidbs: list[siqad_coordinate | offset_coordinate] + self.dimer_policy: dimer_displacement_policy + + +class displacement_robustness_domain_stats: + def __init__(self) -> None: + self.time_total: float + self.num_operational_sidb_displacements: int + self.num_non_operational_sidb_displacements: int + + +class displacement_robustness_domain_100: + def __init__(self) -> None: ... + + +class displacement_robustness_domain_111: + def __init__(self) -> None: ... + + +def determine_displacement_robustness_domain_100( + layout: sidb_100_lattice, + spec: ..., + params: displacement_robustness_domain_params, + stats: displacement_robustness_domain_stats | None = None, +) -> None: ... + + +def determine_displacement_robustness_domain_111( + layout: sidb_111_lattice, + spec: ..., + params: displacement_robustness_domain_params, + stats: displacement_robustness_domain_stats | None = None, +) -> None: ... + + +def occupation_probability_gate_based(energy_and_state_type: list[tuple[float, str]], temperature: float) -> float: ... + + +def occupation_probability_non_gate_based(energy_distribution: list[float], temperature: float) -> float: ... + + +class compute_operational_ratio_params: + def __init__(self) -> None: ... + + +def compute_operational_ratio( + lyt: sidb_100_lattice | sidb_111_lattice, + spec: ..., + pp: parameter_point, + params: compute_operational_ratio_params = ..., +) -> float: ... + + +@overload +def determine_groundstate_from_simulation_results( + simulation_results: sidb_simulation_result_100, +) -> list[charge_distribution_surface_100]: ... + + +@overload +def determine_groundstate_from_simulation_results( + simulation_results: sidb_simulation_result_111, +) -> list[charge_distribution_surface_111]: ... + + +@overload +def minimum_energy(layouts: list[charge_distribution_surface_100]) -> float: ... + + +@overload +def minimum_energy(layouts: list[charge_distribution_surface_111]) -> float: ... + + +class physically_valid_parameters_domain: + def __init__(self) -> None: ... + + def get_excited_state_number_for_parameter(self, pp: parameter_point) -> int: ... + + +@overload +def determine_physically_valid_parameters( + cds: charge_distribution_surface_100, params: operational_domain_params = ... +) -> physically_valid_parameters_domain: ... + + +@overload +def determine_physically_valid_parameters( + cds: charge_distribution_surface_111, params: operational_domain_params = ... +) -> physically_valid_parameters_domain: ... + # Utils # Functions to create various types of truth tables @@ -2078,4 +2389,24 @@ def create_crossing_wire_tt() -> Callable[[int, int], int]: ... def create_fan_out_tt() -> Callable[[int], int]: ... def create_half_adder_tt() -> Callable[[int, int], int]: ... -# TODO all utils + +@overload +def random_coordinate(coordinate1: offset_coordinate, coordinate2: offset_coordinate) -> offset_coordinate: ... + + +@overload +def random_coordinate(coordinate1: cube_coordinate, coordinate2: cube_coordinate) -> cube_coordinate: ... + + +@overload +def random_coordinate(coordinate1: siqad_coordinate, coordinate2: siqad_coordinate) -> siqad_coordinate: ... + + +def normalize_layout_coordinates( + lyt: sidb_100_lattice | sidb_111_lattice | sidb_layout | qca_layout | inml_layout, +) -> None: ... + + +def convert_potential_to_distance( + potential: float, params: sidb_simulation_parameters = ..., precision: float = 2 +) -> Any: ... diff --git a/docs/algorithms/sidb_simulation.rst b/docs/algorithms/sidb_simulation.rst index 4c3e9f30a..73b981f70 100644 --- a/docs/algorithms/sidb_simulation.rst +++ b/docs/algorithms/sidb_simulation.rst @@ -313,6 +313,8 @@ Determine Physically Valid Parameters .. doxygenfunction:: fiction::determine_physically_valid_parameters .. tab:: Python + .. autoclass:: mnt.pyfiction.physically_valid_parameters_domain + :members: .. autoclass:: mnt.pyfiction.determine_physically_valid_parameters From da13edd18603413c9c7e991ddf7f1f89c08d4e8a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 07:32:06 +0000 Subject: [PATCH 37/42] =?UTF-8?q?=F0=9F=8E=A8=20Incorporated=20pre-commit?= =?UTF-8?q?=20fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bindings/mnt/pyfiction/pyfiction.pyi | 716 ++++++++++++--------------- 1 file changed, 313 insertions(+), 403 deletions(-) diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index a31eb32cc..ca3034652 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1,6 +1,8 @@ from enum import Enum from typing import Any, Callable, overload +from typing_extensions import Self + # Layouts class offset_coordinate: @@ -302,7 +304,7 @@ class cartesian_gate_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... @@ -321,7 +323,6 @@ class cartesian_gate_layout(clocked_cartesian_layout): def is_fanout(self) -> bool: ... def is_wire(self) -> bool: ... def set_layout_name(self, name: str) -> None: ... - def set_name(self, name: str) -> None: ... def get_layout_name(self) -> str: ... def set_input_name(self, index: int, name: str) -> None: ... @@ -390,7 +391,7 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... @@ -631,7 +632,7 @@ class qca_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: qca_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> qca_technology.cell_type: ... @@ -658,7 +659,7 @@ class inml_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: inml_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> inml_technology.cell_type: ... @@ -685,7 +686,7 @@ class sidb_layout(clocked_cartesian_layout): def __init__(self, dimension: offset_coordinate) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" ) -> None: ... def assign_cell_type(self, c: offset_coordinate, ct: sidb_technology.cell_type) -> None: ... def get_cell_type(self, c: offset_coordinate) -> sidb_technology.cell_type: ... @@ -774,7 +775,7 @@ class fanout_substitution_params: threshold: int | None def fanout_substitution( - network: technology_network, params: fanout_substitution_params | None = ... + network: technology_network, params: fanout_substitution_params | None = ... ) -> technology_network: ... def is_fanout_substituted(network: technology_network, params: fanout_substitution_params | None = ...) -> bool: ... @@ -784,7 +785,7 @@ class network_balancing_params: unify_outputs: bool def network_balancing( - network: technology_network, params: network_balancing_params | None = ... + network: technology_network, params: network_balancing_params | None = ... ) -> technology_network: ... def is_balanced(network: technology_network, params: network_balancing_params | None = ...) -> bool: ... @@ -819,40 +820,40 @@ def all_standard_2_input_functions() -> technology_mapping_params: ... def all_standard_3_input_functions() -> technology_mapping_params: ... def all_supported_standard_functions() -> technology_mapping_params: ... def technology_mapping( - network: technology_network, - params: technology_mapping_params | None = ..., - stats: technology_mapping_stats | None = None, + network: technology_network, + params: technology_mapping_params | None = ..., + stats: technology_mapping_stats | None = None, ) -> technology_network: ... ## path finding @overload def manhattan_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def manhattan_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @overload def euclidean_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> float: ... @overload def euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... @overload def squared_euclidean_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> float: ... @overload def squared_euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... @overload def twoddwave_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def twoddwave_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @overload def chebyshev_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate ) -> int: ... @overload def chebyshev_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... @@ -864,22 +865,22 @@ class a_star_params: @overload def a_star( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - params: a_star_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + params: a_star_params | None = ..., ) -> list[offset_coordinate]: ... @overload def a_star( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - params: a_star_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + params: a_star_params | None = ..., ) -> list[cube_coordinate]: ... class enumerate_all_paths_params: @@ -889,22 +890,22 @@ class enumerate_all_paths_params: @overload def enumerate_all_paths( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - params: enumerate_all_paths_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + params: enumerate_all_paths_params | None = ..., ) -> list[list[offset_coordinate]]: ... @overload def enumerate_all_paths( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - params: enumerate_all_paths_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + params: enumerate_all_paths_params | None = ..., ) -> list[list[cube_coordinate]]: ... class yen_k_shortest_paths_params: @@ -914,24 +915,24 @@ class yen_k_shortest_paths_params: @overload def yen_k_shortest_paths( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | cartesian_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout - | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, - k: int, - params: yen_k_shortest_paths_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | cartesian_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout + | shifted_cartesian_layout, + source: offset_coordinate, + target: offset_coordinate, + k: int, + params: yen_k_shortest_paths_params | None = ..., ) -> list[list[offset_coordinate]]: ... @overload def yen_k_shortest_paths( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, - k: int, - params: yen_k_shortest_paths_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, + source: cube_coordinate, + target: cube_coordinate, + k: int, + params: yen_k_shortest_paths_params | None = ..., ) -> list[list[cube_coordinate]]: ... # physical design @@ -958,18 +959,18 @@ class color_routing_params: @overload def color_routing( - layout: cartesian_obstruction_layout - | cartesian_gate_layout - | shifted_cartesian_obstruction_layout - | shifted_cartesian_gate_layout, - objectives: list[tuple[offset_coordinate, offset_coordinate]], - params: color_routing_params | None = ..., + layout: cartesian_obstruction_layout + | cartesian_gate_layout + | shifted_cartesian_obstruction_layout + | shifted_cartesian_gate_layout, + objectives: list[tuple[offset_coordinate, offset_coordinate]], + params: color_routing_params | None = ..., ) -> bool: ... @overload def color_routing( - layout: hexagonal_obstruction_layout | hexagonal_gate_layout, - objectives: list[tuple[cube_coordinate, cube_coordinate]], - params: color_routing_params | None = ..., + layout: hexagonal_obstruction_layout | hexagonal_gate_layout, + objectives: list[tuple[cube_coordinate, cube_coordinate]], + params: color_routing_params | None = ..., ) -> bool: ... class technology_constraints(Enum): @@ -1007,13 +1008,13 @@ class exact_stats: def report(self) -> str: ... def exact_cartesian( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> cartesian_gate_layout: ... def exact_shifted_cartesian( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> shifted_cartesian_gate_layout: ... def exact_hexagonal( - network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None + network: technology_network, parameters: exact_params | None = None, statistics: exact_stats | None = None ) -> hexagonal_gate_layout: ... class gold_effort_mode(Enum): @@ -1052,9 +1053,9 @@ class graph_oriented_layout_design_stats: def report(self) -> str: ... def graph_oriented_layout_design( - network: technology_network, - parameters: graph_oriented_layout_design_params | None = ..., - statistics: graph_oriented_layout_design_stats | None = None, + network: technology_network, + parameters: graph_oriented_layout_design_params | None = ..., + statistics: graph_oriented_layout_design_stats | None = None, ) -> cartesian_gate_layout: ... class hexagonalization_stats: @@ -1064,7 +1065,7 @@ class hexagonalization_stats: def report(self) -> str: ... def hexagonalization( - layout: cartesian_gate_layout, statistics: hexagonalization_stats | None = None + layout: cartesian_gate_layout, statistics: hexagonalization_stats | None = None ) -> hexagonal_gate_layout: ... class orthogonal_params: @@ -1082,8 +1083,7 @@ class orthogonal_stats: def report(self) -> None: ... def orthogonal( - network: technology_network, parameters: orthogonal_params | None = ..., - statistics: orthogonal_stats | None = None + network: technology_network, parameters: orthogonal_params | None = ..., statistics: orthogonal_stats | None = None ) -> cartesian_gate_layout: ... class post_layout_optimization_params: @@ -1110,9 +1110,9 @@ class post_layout_optimization_stats: def report(self) -> str: ... def post_layout_optimization( - layout: cartesian_gate_layout, - parameters: post_layout_optimization_params | None = ..., - statistics: post_layout_optimization_stats | None = None, + layout: cartesian_gate_layout, + parameters: post_layout_optimization_params | None = ..., + statistics: post_layout_optimization_stats | None = None, ) -> cartesian_gate_layout: ... class wiring_reduction_params: @@ -1135,25 +1135,22 @@ class wiring_reduction_stats: def report(self) -> str: ... def wiring_reduction( - layout: cartesian_gate_layout, - parameters: wiring_reduction_params | None = ..., - statistics: wiring_reduction_stats | None = None, + layout: cartesian_gate_layout, + parameters: wiring_reduction_params | None = ..., + statistics: wiring_reduction_stats | None = None, ) -> cartesian_gate_layout: ... - - def clear_routing( - lyt: cartesian_obstruction_layout - | cartesian_gate_layout - | shifted_cartesian_layout - | shifted_cartesian_gate_layout - | hexagonal_obstruction_layout - | hexagonal_gate_layout, + lyt: cartesian_obstruction_layout + | cartesian_gate_layout + | shifted_cartesian_layout + | shifted_cartesian_gate_layout + | hexagonal_obstruction_layout + | hexagonal_gate_layout, ) -> None: ... def critical_path_length_and_throughput( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, ) -> tuple[int, int]: ... - # SidB Logic Design class design_sidb_gates_stats: @@ -1173,10 +1170,10 @@ class design_sidb_gates_params: number_of_sidbs: int def design_sidb_gates( - skeleton: sidb_100_lattice | sidb_111_lattice, - spec: [[int, int], int], - params: design_sidb_gates_params = ..., - stats: design_sidb_gates_stats | None = None, + skeleton: sidb_100_lattice | sidb_111_lattice, + spec: [[int, int], int], + params: design_sidb_gates_params = ..., + stats: design_sidb_gates_stats | None = None, ) -> list[sidb_100_lattice | sidb_111_lattice]: ... ## simulation @@ -1187,7 +1184,7 @@ def design_sidb_gates( def simulate(network: technology_network) -> dict[str, list[bool]]: ... @overload def simulate( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, ) -> dict[str, list[bool]]: ... ## verification @@ -1207,9 +1204,9 @@ class gate_level_drv_params: border_io: bool def gate_level_drvs( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - params: gate_level_drv_params | None = ..., - print_report: bool | None = False, + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + params: gate_level_drv_params | None = ..., + print_report: bool | None = False, ) -> tuple[int, int]: ... class eq_type(Enum): @@ -1228,9 +1225,9 @@ class equivalence_checking_stats: runtime: float def equivalence_checking( - specification: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - implementation: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - statistics: equivalence_checking_stats | None = None, + specification: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + implementation: technology_network | cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + statistics: equivalence_checking_stats | None = None, ) -> eq_type: ... # In/Out @@ -1247,20 +1244,16 @@ class unrecognized_cell_definition_exception(Exception): ... def read_fqca_layout(filename: str, layout_name: str = "") -> qca_layout: ... - class sqd_parsing_error(RuntimeError): ... - def read_sqd_layout_100(filename: str, layout_name: str = "") -> sidb_100_lattice: ... - - def read_sqd_layout_111(filename: str, layout_name: str = "") -> sidb_111_lattice: ... def write_dot_network(network: technology_network, filename: str) -> None: ... def write_dot_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str ) -> None: ... def write_fgl_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, filename: str ) -> None: ... class out_of_cell_names_exception(IndexError): ... @@ -1271,41 +1264,35 @@ class write_fqca_layout_params: create_inter_layer_via_cells: bool def write_fqca_layout( - layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, - filename: str, - params: write_fqca_layout_params | None = ..., + layout: cartesian_gate_layout | shifted_cartesian_gate_layout | hexagonal_gate_layout, + filename: str, + params: write_fqca_layout_params | None = ..., ) -> None: ... - class sample_writing_mode(Enum): ALL_SAMPLES: ... OPERATIONAL_ONLY: ... - class write_operational_domain_params: def __init__(self) -> None: self.operational_tag: str self.non_operational_tag: str self.writing_mode: sample_writing_mode - def write_operational_domain( - opdom: operational_domain, filename: str, params: write_operational_domain_params | None = None + opdom: operational_domain, filename: str, params: write_operational_domain_params | None = None ) -> None: ... - class color_mode(Enum): """Enumeration for color modes in the SVG layout.""" LIGHT: int # Light mode for the layout colors DARK: int # Dark mode for the layout colors - class sidb_lattice_mode(Enum): SHOW_LATTICE: ... HIDE_LATTICE: ... - class write_sidb_layout_svg_params: def __init__(self) -> None: self.lattice_point_size: float @@ -1315,22 +1302,15 @@ class write_sidb_layout_svg_params: self.color_mode: color_mode self.lattice_mode: sidb_lattice_mode - class write_qca_layout_svg_params: def __init__(self) -> None: ... - def write_sidb_layout_svg( - layout: sidb_100_lattice | sidb_111_lattice | sidb_layout, filename: str, - params: write_sidb_layout_svg_params = ... + layout: sidb_100_lattice | sidb_111_lattice | sidb_layout, filename: str, params: write_sidb_layout_svg_params = ... ) -> None: ... - - def write_sidb_layout_svg_to_string( - layout: sidb_100_lattice | sidb_111_lattice | sidb_layout, params: write_sidb_layout_svg_params = ... + layout: sidb_100_lattice | sidb_111_lattice | sidb_layout, params: write_sidb_layout_svg_params = ... ) -> str: ... - - def write_qca_layout_svg(layout: sidb_layout, filename: str, params: write_sidb_layout_svg_params = ...) -> None: ... class write_qca_layout_params: @@ -1338,13 +1318,12 @@ class write_qca_layout_params: create_inter_layer_via_cells: bool - def write_qca_layout(layout: qca_layout, filename: str, params: write_qca_layout_params = ...) -> None: ... def write_qcc_layout(layout: inml_layout, filename: str) -> None: ... def write_qll_layout(layout: qca_layout | inml_layout, filename: str) -> None: ... def write_sqd_layout( - layout: sidb_111_lattice | sidb_100_lattice | sidb_layout, - filename: str, + layout: sidb_111_lattice | sidb_100_lattice | sidb_layout, + filename: str, ) -> None: ... def write_sqd_sim_result(layout: sidb_layout, filename: str) -> None: ... @@ -1356,10 +1335,9 @@ def area(layout: qca_layout, width: int = 18, height: int = 18, hspace: int = 2, def area(layout: inml_layout, width: int = 50, height: int = 100, hspace: int = 10, vspace: int = 25) -> float: ... @overload def area( - layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, vspace: float = 0.384 + layout: sidb_layout, width: float = 0.0, height: float = 0.0, hspace: float = 0.384, vspace: float = 0.384 ) -> float: ... - # SiDB Technology class input_bdl_configuration(Enum): @@ -1384,9 +1362,9 @@ class bdl_input_iterator: def __gt__(self, n: int) -> bool: ... def __ge__(self, n: int) -> bool: ... def __add__(self, n: int) -> bdl_input_iterator: ... - def __iadd__(self, n: int) -> bdl_input_iterator: ... + def __iadd__(self, n: int) -> Self: ... def __sub__(self, n: int) -> bdl_input_iterator: ... - def __isub__(self, n: int) -> bdl_input_iterator: ... + def __isub__(self, n: int) -> Self: ... def __getitem__(self, n: int) -> bdl_input_iterator: ... def num_input_pairs(self) -> int: ... def get_layout(self) -> object: ... @@ -1407,9 +1385,9 @@ class detect_bdl_pairs_params: self.maximum_distance: float def detect_bdl_pairs( - lyt: sidb_100_lattice | sidb_111_lattice, - type: sidb_technology.cell_type | None = None, - params: detect_bdl_pairs_params = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + type: sidb_technology.cell_type | None = None, + params: detect_bdl_pairs_params = ..., ) -> list[bdl_pair]: ... class sidb_defect_type(Enum): @@ -1430,11 +1408,11 @@ class sidb_defect_type(Enum): class sidb_defect: def __init__( - self, - defect_type: sidb_defect_type = ..., - electric_charge: int = 0, - relative_permittivity: float = 0.0, - screening_distance: float = 0.0, + self, + defect_type: sidb_defect_type = ..., + electric_charge: int = 0, + relative_permittivity: float = 0.0, + screening_distance: float = 0.0, ) -> None: def __eq__(self, rhs: sidb_defect) -> bool: ... def __ne__(self, rhs: sidb_defect) -> bool: ... @@ -1450,9 +1428,9 @@ def is_positively_charged_defect(defect: sidb_defect_type) -> bool: ... def is_negatively_charged_defect(defect: sidb_defect_type) -> bool: ... def is_neutrally_charged_defect(defect: sidb_defect_type) -> bool: ... def defect_extent( - defect: sidb_defect_type, - charged_defect_spacing_overwrite: float | None = None, - neutral_defect_spacing_overwrite: float | None = None, + defect: sidb_defect_type, + charged_defect_spacing_overwrite: float | None = None, + neutral_defect_spacing_overwrite: float | None = None, ) -> float: ... class sidb_charge_state(Enum): @@ -1499,10 +1477,10 @@ class charge_distribution_surface_100(sidb_100_lattice): def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( - self, - lyt: charge_distribution_surface_100, - params: sidb_simulation_parameters = ..., - cs: sidb_charge_state = ..., + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., ) -> None: ... @overload def __init__(self, lyt: charge_distribution_surface_100) -> None: ... @@ -1513,7 +1491,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def charge_exists(self, cs: sidb_charge_state) -> bool: ... def cell_to_index(self, c: offset_coordinate) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... @@ -1522,7 +1500,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... def erase_defect(self, c: offset_coordinate) -> None: ... def assign_charge_state_by_cell_index( - self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... @@ -1542,10 +1520,10 @@ class charge_distribution_surface_100(sidb_100_lattice): def recompute_system_energy(self) -> None: ... def get_system_energy(self) -> float: ... def update_after_charge_change( - self, - dep_cell: dependent_cell_mode = ..., - energy_calculation_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def validity_check(self) -> bool: ... def is_physically_valid(self) -> bool: ... @@ -1553,17 +1531,17 @@ class charge_distribution_surface_100(sidb_100_lattice): def charge_distribution_to_index(self) -> int: ... def get_charge_index_and_base(self) -> tuple[int, int]: ... def increase_charge_index_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( - self, potential_value: float, dependent_cell: dependent_cell_mode = ... + self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... @@ -1574,7 +1552,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... def chargeless_potential_at_given_distance(self, distance: float) -> float: ... def chargeless_potential_generated_by_defect_at_given_distance( - self, distance: float, defect: sidb_defect + self, distance: float, defect: sidb_defect ) -> float: ... def assign_local_external_potential(self, external_potential: float) -> None: ... def get_local_external_potentials(self) -> list[float]: ... @@ -1584,19 +1562,19 @@ class charge_distribution_surface_100(sidb_100_lattice): def get_charge_index_of_sub_layout(self) -> int: ... def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... def increase_charge_index_of_sub_layout_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def assign_charge_index_by_gray_code( - self, - current_gray_code: int, - previous_gray_code: int, - dependent_cell: dependent_cell_mode = ..., - energy_calc_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def reset_charge_index_sub_layout(self) -> None: ... def get_max_charge_index_sub_layout(self) -> int: ... @@ -1613,10 +1591,10 @@ class charge_distribution_surface_111(sidb_111_lattice): def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( - self, - lyt: charge_distribution_surface_100, - params: sidb_simulation_parameters = ..., - cs: sidb_charge_state = ..., + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., ) -> None: ... @overload def __init__(self, lyt: charge_distribution_surface_100) -> None: ... @@ -1627,7 +1605,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def charge_exists(self, cs: sidb_charge_state) -> bool: ... def cell_to_index(self, c: offset_coordinate) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... @@ -1636,7 +1614,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... def erase_defect(self, c: offset_coordinate) -> None: ... def assign_charge_state_by_cell_index( - self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... @@ -1656,10 +1634,10 @@ class charge_distribution_surface_111(sidb_111_lattice): def recompute_system_energy(self) -> None: ... def get_system_energy(self) -> float: ... def update_after_charge_change( - self, - dep_cell: dependent_cell_mode = ..., - energy_calculation_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def validity_check(self) -> bool: ... def is_physically_valid(self) -> bool: ... @@ -1667,17 +1645,17 @@ class charge_distribution_surface_111(sidb_111_lattice): def charge_distribution_to_index(self) -> int: ... def get_charge_index_and_base(self) -> tuple[int, int]: ... def increase_charge_index_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( - self, potential_value: float, dependent_cell: dependent_cell_mode = ... + self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... @@ -1688,7 +1666,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... def chargeless_potential_at_given_distance(self, distance: float) -> float: ... def chargeless_potential_generated_by_defect_at_given_distance( - self, distance: float, defect: sidb_defect + self, distance: float, defect: sidb_defect ) -> float: ... def assign_local_external_potential(self, external_potential: float) -> None: ... def get_local_external_potentials(self) -> list[float]: ... @@ -1698,19 +1676,19 @@ class charge_distribution_surface_111(sidb_111_lattice): def get_charge_index_of_sub_layout(self) -> int: ... def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... def increase_charge_index_of_sub_layout_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def assign_charge_index_by_gray_code( - self, - current_gray_code: int, - previous_gray_code: int, - dependent_cell: dependent_cell_mode = ..., - energy_calc_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def reset_charge_index_sub_layout(self) -> None: ... def get_max_charge_index_sub_layout(self) -> int: ... @@ -1727,10 +1705,10 @@ class charge_distribution_surface(sidb_layout): def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( - self, - lyt: charge_distribution_surface_100, - params: sidb_simulation_parameters = ..., - cs: sidb_charge_state = ..., + self, + lyt: charge_distribution_surface_100, + params: sidb_simulation_parameters = ..., + cs: sidb_charge_state = ..., ) -> None: ... @overload def __init__(self, lyt: charge_distribution_surface_100) -> None: ... @@ -1741,7 +1719,7 @@ class charge_distribution_surface(sidb_layout): def charge_exists(self, cs: sidb_charge_state) -> bool: ... def cell_to_index(self, c: offset_coordinate) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... @@ -1750,7 +1728,7 @@ class charge_distribution_surface(sidb_layout): def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... def erase_defect(self, c: offset_coordinate) -> None: ... def assign_charge_state_by_cell_index( - self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... @@ -1770,10 +1748,10 @@ class charge_distribution_surface(sidb_layout): def recompute_system_energy(self) -> None: ... def get_system_energy(self) -> float: ... def update_after_charge_change( - self, - dep_cell: dependent_cell_mode = ..., - energy_calculation_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + dep_cell: dependent_cell_mode = ..., + energy_calculation_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def validity_check(self) -> bool: ... def is_physically_valid(self) -> bool: ... @@ -1781,17 +1759,17 @@ class charge_distribution_surface(sidb_layout): def charge_distribution_to_index(self) -> int: ... def get_charge_index_and_base(self) -> tuple[int, int]: ... def increase_charge_index_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( - self, potential_value: float, dependent_cell: dependent_cell_mode = ... + self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... @@ -1802,7 +1780,7 @@ class charge_distribution_surface(sidb_layout): def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... def chargeless_potential_at_given_distance(self, distance: float) -> float: ... def chargeless_potential_generated_by_defect_at_given_distance( - self, distance: float, defect: sidb_defect + self, distance: float, defect: sidb_defect ) -> float: ... def assign_local_external_potential(self, external_potential: float) -> None: ... def get_local_external_potentials(self) -> list[float]: ... @@ -1812,19 +1790,19 @@ class charge_distribution_surface(sidb_layout): def get_charge_index_of_sub_layout(self) -> int: ... def charge_index_gray_code_to_charge_distribution(self, new_gray_code: int, old_gray_code: int) -> None: ... def increase_charge_index_of_sub_layout_by_one( - self, - dependent_cell_fixed: dependent_cell_mode = ..., - recompute_system_energy: energy_calculation = ..., - consider_history: charge_distribution_history = ..., - engine: exact_sidb_simulation_engine = ..., + self, + dependent_cell_fixed: dependent_cell_mode = ..., + recompute_system_energy: energy_calculation = ..., + consider_history: charge_distribution_history = ..., + engine: exact_sidb_simulation_engine = ..., ) -> None: ... def assign_charge_index_by_gray_code( - self, - current_gray_code: int, - previous_gray_code: int, - dependent_cell: dependent_cell_mode = ..., - energy_calc_mode: energy_calculation = ..., - history_mode: charge_distribution_history = ..., + self, + current_gray_code: int, + previous_gray_code: int, + dependent_cell: dependent_cell_mode = ..., + energy_calc_mode: energy_calculation = ..., + history_mode: charge_distribution_history = ..., ) -> None: ... def reset_charge_index_sub_layout(self) -> None: ... def get_max_charge_index_sub_layout(self) -> int: ... @@ -1837,20 +1815,16 @@ class charge_distribution_surface(sidb_layout): def is_within_bounds(self, c: tuple[int, int, int]) -> bool: ... def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... - class sidb_simulation_parameters: def __init__(self) -> None: ... - @overload def exhaustive_ground_state_simulation( - lyt: sidb_100_lattice, params: sidb_simulation_parameters = ... + lyt: sidb_100_lattice, params: sidb_simulation_parameters = ... ) -> sidb_simulation_result_100: ... - - @overload def exhaustive_ground_state_simulation( - lyt: sidb_111_lattice, params: sidb_simulation_parameters = ... + lyt: sidb_111_lattice, params: sidb_simulation_parameters = ... ) -> sidb_simulation_result_111: ... class sidb_simulation_engine(Enum): @@ -1864,21 +1838,18 @@ class exact_sidb_simulation_engine(Enum): @overload def sidb_nm_position( - lyt: charge_distribution_surface | sidb_layout | sidb_100_lattice | sidb_111_lattice, - c: sidb_technology.cell_type + lyt: charge_distribution_surface | sidb_layout | sidb_100_lattice | sidb_111_lattice, c: sidb_technology.cell_type ) -> None: ... def sidb_nm_distance_111(lyt: sidb_111_lattice, c: sidb_technology.cell_type) -> None: ... - - def sidb_nm_distance_100(lyt: sidb_100_lattice, c: sidb_technology.cell_type) -> None: ... class sidb_simulation_parameters: def __init__( - self, - base_number: int = 3, - mu_minus: float = -0.32, - relative_permittivity: float = 5.6, - screening_distance: float = 5.0, + self, + base_number: int = 3, + mu_minus: float = -0.32, + relative_permittivity: float = 5.6, + screening_distance: float = 5.0, ) -> None: ... def k(self) -> float: ... def mu_plus(self) -> float: ... @@ -1910,10 +1881,10 @@ class assess_physical_population_stability_params: precision_for_distance_corresponding_to_potential: float def assess_physical_population_stability_100( - lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... + lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... ) -> list[population_stability_information]: ... def assess_physical_population_stability_111( - lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... + lyt: sidb_100_lattice, params: assess_physical_population_stability_params = ... ) -> list[population_stability_information]: ... def energy_distribution(input_vec: list[charge_distribution_surface]) -> dict[float, int]: ... @@ -1945,10 +1916,10 @@ class detect_bdl_wires_params: bdl_pairs_params: object def detect_bdl_wires_100( - lyt: sidb_100_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... + lyt: sidb_100_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... ) -> list[bdl_wire_100]: ... def detect_bdl_wires_111( - lyt: sidb_111_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... + lyt: sidb_111_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... ) -> list[bdl_wire_111]: ... # Enums @@ -1973,43 +1944,43 @@ class is_operational_params: @overload def is_operational( - lyt: sidb_100_lattice, - spec: object, - params: is_operational_params = ..., - input_bdl_wire: bdl_wire_100 | None = None, - output_bdl_wire: bdl_wire_100 | None = None, + lyt: sidb_100_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: bdl_wire_100 | None = None, + output_bdl_wire: bdl_wire_100 | None = None, ) -> operational_status: ... @overload def is_operational( - lyt: sidb_100_lattice, - spec: object, - params: is_operational_params = ..., - input_bdl_wire: bdl_wire_111 | None = None, - output_bdl_wire: bdl_wire_111 | None = None, + lyt: sidb_100_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: bdl_wire_111 | None = None, + output_bdl_wire: bdl_wire_111 | None = None, ) -> operational_status: ... @overload def operational_input_patterns( - lyt: sidb_100_lattice, - spec: object, # Type depends on the specification - params: is_operational_params = ..., + lyt: sidb_100_lattice, + spec: object, # Type depends on the specification + params: is_operational_params = ..., ) -> list[int]: ... @overload def operational_input_patterns( - lyt: sidb_111_lattice, - spec: object, # Type depends on the specification - params: is_operational_params = ..., + lyt: sidb_111_lattice, + spec: object, # Type depends on the specification + params: is_operational_params = ..., ) -> list[int]: ... def is_kink_induced_non_operational( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: object, - params: is_operational_params = ..., - input_bdl_wire: object | None = None, - output_bdl_wire: object | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: object, + params: is_operational_params = ..., + input_bdl_wire: object | None = None, + output_bdl_wire: object | None = None, ) -> operational_status: ... def kink_induced_non_operational_input_patterns( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: object, - params: is_operational_params = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + spec: object, + params: is_operational_params = ..., ) -> object: ... # QuickExact @@ -2052,15 +2023,15 @@ class critical_temperature_params: max_temperature: float def critical_temperature_gate_based( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - params: critical_temperature_params | None = ..., - stats: critical_temperature_stats | None = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + params: critical_temperature_params | None = ..., + stats: critical_temperature_stats | None = ..., ) -> float | None: ... def critical_temperature_non_gate_based( - lyt: sidb_100_lattice | sidb_111_lattice, - params: critical_temperature_params | None = ..., - stats: critical_temperature_stats | None = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + params: critical_temperature_params | None = ..., + stats: critical_temperature_stats | None = ..., ) -> float | None: ... class parameter_point: @@ -2078,8 +2049,7 @@ class sweep_parameter(Enum): class operational_domain_value_range: def __init__( - self, dimension: sweep_parameter, min: float | None = None, max: float | None = None, - step: float | None = None + self, dimension: sweep_parameter, min: float | None = None, max: float | None = None, step: float | None = None ) -> None: ... dimension: sweep_parameter @@ -2111,70 +2081,58 @@ class operational_domain: def get_value(self, point: parameter_point) -> str: ... def operational_domain_grid_search( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... def operational_domain_random_sampling( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - samples: int, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... def operational_domain_flood_fill( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - samples: int, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... def operational_domain_contour_tracing( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: dict, - samples: int, - params: operational_domain_params | None = None, - stats: operational_domain_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + spec: dict, + samples: int, + params: operational_domain_params | None = None, + stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... - - def calculate_energy_and_state_type_with_kinks_accepted( - sidb_energy_distribution: ..., valid_charge_distributions: ..., output_bdl_pairs: ..., spec: ..., - input_index: ... + sidb_energy_distribution: ..., valid_charge_distributions: ..., output_bdl_pairs: ..., spec: ..., input_index: ... ) -> None: ... - - def calculate_energy_and_state_type_with_kinks_rejected( - energy_distribution: ..., - valid_charge_distributions: ..., - spec: ..., - input_index: ..., - input_bdl_wires: ..., - output_bdl_wires: ..., + energy_distribution: ..., + valid_charge_distributions: ..., + spec: ..., + input_index: ..., + input_bdl_wires: ..., + output_bdl_wires: ..., ) -> None: ... - - def can_positive_charges_occur( - lyt: sidb_100_lattice | sidb_111_lattice, - sim_params: sidb_simulation_parameters, + lyt: sidb_100_lattice | sidb_111_lattice, + sim_params: sidb_simulation_parameters, ) -> bool: ... - - @overload def check_simulation_results_for_equivalence( - result1: sidb_simulation_result_100, - result2: sidb_simulation_result_100, + result1: sidb_simulation_result_100, + result2: sidb_simulation_result_100, ) -> bool: ... - - @overload def check_simulation_results_for_equivalence( - result1: sidb_simulation_result_111, - result2: sidb_simulation_result_111, + result1: sidb_simulation_result_111, + result2: sidb_simulation_result_111, ) -> bool: ... - class sidb_simulation_result_100: def __init__(self) -> None: self.algorithm_name: str @@ -2189,7 +2147,6 @@ class sidb_simulation_result_100: simulation_parameters: sidb_simulation_parameters additional_simulation_parameters: dict[str, Any] - class sidb_simulation_result_111: def __init__(self) -> None: self.algorithm_name: str @@ -2204,14 +2161,12 @@ class sidb_simulation_result_111: simulation_parameters: sidb_simulation_parameters additional_simulation_parameters: dict[str, Any] - class time_to_solution_params: def __init__(self) -> None: self.engine: str self.repetitions: int self.confidence_level: float - class time_to_solution_stats: def __init__(self) -> None: self.time_to_solution: float @@ -2222,47 +2177,37 @@ class time_to_solution_stats: def report(self, stream: str | None = None) -> None: ... - def time_to_solution( - lyt: sidb_100_lattice | sidb_111_lattice, - quickim_params: quicksim_params, - tts_params: time_to_solution_params = ..., - ps: time_to_solution_stats | None = None, + lyt: sidb_100_lattice | sidb_111_lattice, + quickim_params: quicksim_params, + tts_params: time_to_solution_params = ..., + ps: time_to_solution_stats | None = None, ) -> time_to_solution_stats: ... - - def time_to_solution_for_given_simulation_results( - results_exact: sidb_simulation_result_100 | sidb_simulation_result_111, - results_heuristic: list[sidb_simulation_result_100 | sidb_simulation_result_111], - confidence_level: float = 0.997, - ps: time_to_solution_stats | None = None, + results_exact: sidb_simulation_result_100 | sidb_simulation_result_111, + results_heuristic: list[sidb_simulation_result_100 | sidb_simulation_result_111], + confidence_level: float = 0.997, + ps: time_to_solution_stats | None = None, ) -> time_to_solution_stats: ... - - @overload def is_ground_state( - heuristic_results: sidb_simulation_result_100, - exhaustive_results: sidb_simulation_result_100, + heuristic_results: sidb_simulation_result_100, + exhaustive_results: sidb_simulation_result_100, ) -> bool: ... - - @overload def is_ground_state( - heuristic_results: sidb_simulation_result_111, - exhaustive_results: sidb_simulation_result_111, + heuristic_results: sidb_simulation_result_111, + exhaustive_results: sidb_simulation_result_111, ) -> bool: ... - class displacement_analysis_mode(Enum): EXHAUSTIVE = 0 RANDOM = 1 - class dimer_displacement_policy(Enum): STAY_ON_ORIGINAL_DIMER = 0 ALLOW_OTHER_DIMER = 1 - class displacement_robustness_domain_params: def __init__(self) -> None: self.analysis_mode: displacement_analysis_mode @@ -2272,91 +2217,66 @@ class displacement_robustness_domain_params: self.fixed_sidbs: list[siqad_coordinate | offset_coordinate] self.dimer_policy: dimer_displacement_policy - class displacement_robustness_domain_stats: def __init__(self) -> None: self.time_total: float self.num_operational_sidb_displacements: int self.num_non_operational_sidb_displacements: int - class displacement_robustness_domain_100: def __init__(self) -> None: ... - class displacement_robustness_domain_111: def __init__(self) -> None: ... - def determine_displacement_robustness_domain_100( - layout: sidb_100_lattice, - spec: ..., - params: displacement_robustness_domain_params, - stats: displacement_robustness_domain_stats | None = None, + layout: sidb_100_lattice, + spec: ..., + params: displacement_robustness_domain_params, + stats: displacement_robustness_domain_stats | None = None, ) -> None: ... - - def determine_displacement_robustness_domain_111( - layout: sidb_111_lattice, - spec: ..., - params: displacement_robustness_domain_params, - stats: displacement_robustness_domain_stats | None = None, + layout: sidb_111_lattice, + spec: ..., + params: displacement_robustness_domain_params, + stats: displacement_robustness_domain_stats | None = None, ) -> None: ... - - def occupation_probability_gate_based(energy_and_state_type: list[tuple[float, str]], temperature: float) -> float: ... - - def occupation_probability_non_gate_based(energy_distribution: list[float], temperature: float) -> float: ... - class compute_operational_ratio_params: def __init__(self) -> None: ... - def compute_operational_ratio( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: ..., - pp: parameter_point, - params: compute_operational_ratio_params = ..., + lyt: sidb_100_lattice | sidb_111_lattice, + spec: ..., + pp: parameter_point, + params: compute_operational_ratio_params = ..., ) -> float: ... - - @overload def determine_groundstate_from_simulation_results( - simulation_results: sidb_simulation_result_100, + simulation_results: sidb_simulation_result_100, ) -> list[charge_distribution_surface_100]: ... - - @overload def determine_groundstate_from_simulation_results( - simulation_results: sidb_simulation_result_111, + simulation_results: sidb_simulation_result_111, ) -> list[charge_distribution_surface_111]: ... - - @overload def minimum_energy(layouts: list[charge_distribution_surface_100]) -> float: ... - - @overload def minimum_energy(layouts: list[charge_distribution_surface_111]) -> float: ... - class physically_valid_parameters_domain: def __init__(self) -> None: ... - def get_excited_state_number_for_parameter(self, pp: parameter_point) -> int: ... - @overload def determine_physically_valid_parameters( - cds: charge_distribution_surface_100, params: operational_domain_params = ... + cds: charge_distribution_surface_100, params: operational_domain_params = ... ) -> physically_valid_parameters_domain: ... - - @overload def determine_physically_valid_parameters( - cds: charge_distribution_surface_111, params: operational_domain_params = ... + cds: charge_distribution_surface_111, params: operational_domain_params = ... ) -> physically_valid_parameters_domain: ... # Utils @@ -2388,25 +2308,15 @@ def create_double_wire_tt() -> Callable[[int, int], int]: ... def create_crossing_wire_tt() -> Callable[[int, int], int]: ... def create_fan_out_tt() -> Callable[[int], int]: ... def create_half_adder_tt() -> Callable[[int, int], int]: ... - - @overload def random_coordinate(coordinate1: offset_coordinate, coordinate2: offset_coordinate) -> offset_coordinate: ... - - @overload def random_coordinate(coordinate1: cube_coordinate, coordinate2: cube_coordinate) -> cube_coordinate: ... - - @overload def random_coordinate(coordinate1: siqad_coordinate, coordinate2: siqad_coordinate) -> siqad_coordinate: ... - - def normalize_layout_coordinates( - lyt: sidb_100_lattice | sidb_111_lattice | sidb_layout | qca_layout | inml_layout, + lyt: sidb_100_lattice | sidb_111_lattice | sidb_layout | qca_layout | inml_layout, ) -> None: ... - - def convert_potential_to_distance( - potential: float, params: sidb_simulation_parameters = ..., precision: float = 2 + potential: float, params: sidb_simulation_parameters = ..., precision: float = 2 ) -> Any: ... From c493ced825de622709e7014c076edcafe095e9c2 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 10 Dec 2024 10:05:00 +0100 Subject: [PATCH 38/42] :bug: Fix compilation issue due to broken include --- .../simulation/sidb/determine_physically_valid_parameters.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp index 06356c19c..4615fba5b 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/determine_physically_valid_parameters.hpp @@ -15,8 +15,7 @@ #include #include - -#include << stdexcept> +#include namespace pyfiction { From b8609e7990d01236a65c96ca72b95199e3c7ce29 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 10 Dec 2024 10:06:02 +0100 Subject: [PATCH 39/42] :bug: Restore file that was mysteriously overwritten with a different one --- .../include/pyfiction/utils/layout_utils.hpp | 85 ++++++++++++++++--- 1 file changed, 75 insertions(+), 10 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp b/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp index 8dd9bc6c9..6612fe2c3 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/utils/layout_utils.hpp @@ -1,25 +1,90 @@ // -// Created by Jan Drewniok on 11.11.24. +// Created by marcel on 21.11.23. // -#ifndef PYFICTION_VERSION_INFO_HPP -#define PYFICTION_VERSION_INFO_HPP +#ifndef PYFICTION_LAYOUT_UTILS_HPP +#define PYFICTION_LAYOUT_UTILS_HPP -#include +#include "pyfiction/documentation.hpp" +#include "pyfiction/types.hpp" + +#include +#include #include namespace pyfiction { -inline void version_info(pybind11::module& m) +namespace detail +{ + +template +void num_adjacent_coordinates(pybind11::module& m) +{ + namespace py = pybind11; + + m.def("num_adjacent_coordinates", &fiction::num_adjacent_coordinates, py::arg("lyt"), py::arg("c"), + DOC(fiction_num_adjacent_coordinates)); +} + +template +void normalize_layout_coordinates(pybind11::module& m) +{ + namespace py = pybind11; + + m.def("normalize_layout_coordinates", &fiction::normalize_layout_coordinates, py::arg("lyt"), + DOC(fiction_normalize_layout_coordinates)); +} + +template +void convert_to_siqad_coordinates(pybind11::module& m) +{ + namespace py = pybind11; + + m.def("convert_layout_to_siqad_coordinates", &fiction::convert_layout_to_siqad_coordinates, py::arg("lyt"), + DOC(fiction_convert_layout_to_siqad_coordinates)); +} + +template +void random_coordinate(pybind11::module& m) +{ + namespace py = pybind11; + + m.def("random_coordinate", &fiction::random_coordinate>, py::arg("coordinate1"), + py::arg("coordinate_2"), DOC(fiction_random_coordinate)); +} + +} // namespace detail + +inline void layout_utils(pybind11::module& m) { - m.attr("__version__") = fiction::FICTION_VERSION; - m.attr("__repo__") = fiction::FICTION_REPO; - m.attr("__compiled_date__") = fiction::COMPILED_DATE; - m.attr("__compiled_time__") = fiction::COMPILED_TIME; + // NOTE be careful with the order of the following calls! Python will resolve the first matching overload! + + detail::num_adjacent_coordinates(m); + detail::num_adjacent_coordinates(m); + detail::num_adjacent_coordinates(m); + detail::num_adjacent_coordinates(m); + detail::num_adjacent_coordinates(m); + detail::num_adjacent_coordinates(m); + + detail::normalize_layout_coordinates(m); + detail::normalize_layout_coordinates(m); + detail::normalize_layout_coordinates(m); + + detail::convert_to_siqad_coordinates(m); + + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); + detail::random_coordinate(m); } } // namespace pyfiction -#endif // PYFICTION_VERSION_INFO_HPP +#endif // PYFICTION_LAYOUT_UTILS_HPP From 3814730dfc481a13c94746b89dfa5f8d5d646da9 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Tue, 10 Dec 2024 09:29:59 +0000 Subject: [PATCH 40/42] :memo: Update pyfiction docstrings Signed-off-by: GitHub Actions --- .../pyfiction/pybind11_mkdoc_docstrings.hpp | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) diff --git a/bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp b/bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp index 194480717..2540f3e3c 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp @@ -1122,6 +1122,56 @@ static const char *__doc_fiction_bounding_box_2d_x_size = R"doc(The horizontal s static const char *__doc_fiction_bounding_box_2d_y_size = R"doc(The vertical size of the bounding box in layout coordinates.)doc"; +static const char *__doc_fiction_branching_signal_container = +R"doc(A container class to help identify layout locations of branching nodes +like fanouts. When a node from a network is to placed in a layout, +fetching the node's fanins and looking for their locations in the +layout does not work properly when branching nodes like fanouts are +involved that got extended by wire nodes. This container solves that +issue. + +Template parameter ``Lyt``: + Gate-level layout type. + +Template parameter ``Ntk``: + Logic network type. + +Template parameter ``fanout_size``: + Maximum fanout size possible in the layout and/or the network.)doc"; + +static const char *__doc_fiction_branching_signal_container_branches = R"doc(Storage for all branches.)doc"; + +static const char *__doc_fiction_branching_signal_container_branching_signal = R"doc(Branch type.)doc"; + +static const char *__doc_fiction_branching_signal_container_branching_signal_branching_signal = R"doc()doc"; + +static const char *__doc_fiction_branching_signal_container_branching_signal_lyt_signal = R"doc()doc"; + +static const char *__doc_fiction_branching_signal_container_branching_signal_ntk_node = R"doc()doc"; + +static const char *__doc_fiction_branching_signal_container_operator_array = +R"doc(Accesses the branching container to find the location of a given node +`n`. Returns the signal to that location if it was already stored or +the default signal, otherwise. + +Parameter ``n``: + Node whose branching position is desired. + +Returns: + Signal to `n`'s layout location or the default signal if it wasn't + found.)doc"; + +static const char *__doc_fiction_branching_signal_container_update_branch = +R"doc(Updates the given node's branch by another layout signal, thereby, +creating a new branch or updating the position of an existing one, +e.g., if further wire segments were moving the head of the branch. + +Parameter ``ntk_node``: + Node whose branch is to be updated. + +Parameter ``lyt_signal``: + New signal pointing to the end of the branch.)doc"; + static const char *__doc_fiction_calculate_energy_and_state_type_with_kinks_accepted = R"doc(This function takes in an SiDB energy distribution. For each charge distribution, the state type is determined (i.e. erroneous, @@ -10152,6 +10202,20 @@ Parameter ``lyt``: Returns: List of all routing objectives in the given layout.)doc"; +static const char *__doc_fiction_fanin_container = +R"doc(Container that stores fanins of a node in a network, including whether +one of them is a constant. + +Note that this container assumes that each node has a maximum of one +constant fanin. + +Template parameter ``Ntk``: + `mockturtle` network type.)doc"; + +static const char *__doc_fiction_fanin_container_constant_fanin = +R"doc(Has a value if a fanin node is constant. In that case, it represents +the constant value.)doc"; + static const char *__doc_fiction_fanin_edge_container = R"doc(Container that stores fanin edges of a node in a network, including whether one of them is a constant. @@ -15125,6 +15189,158 @@ static const char *__doc_fiction_path_set_add = R"doc()doc"; static const char *__doc_fiction_path_set_contains = R"doc()doc"; static const char *__doc_fiction_place = +R"doc(Place 0-input gates. + +Template parameter ``Lyt``: + Gate-level layout type. + +Template parameter ``Ntk``: + Logic network type. + +Parameter ``lyt``: + Gate-level layout in which to place a 0-input gate. + +Parameter ``t``: + Tile in `lyt` to place the gate onto. + +Parameter ``ntk``: + Network whose node is to be placed. + +Parameter ``n``: + Node in `ntk` to place onto `t` in `lyt`. + +Returns: + Signal pointing to the placed gate in `lyt`.)doc"; + +static const char *__doc_fiction_place_2 = +R"doc(Place 1-input gates. + +Template parameter ``Lyt``: + Gate-level layout type. + +Template parameter ``Ntk``: + Logic network type. + +Parameter ``lyt``: + Gate-level layout in which to place a 1-input gate. + +Parameter ``t``: + Tile in `lyt` to place the gate onto. + +Parameter ``ntk``: + Network whose node is to be placed. + +Parameter ``n``: + Node in `ntk` to place onto `t` in `lyt`. + +Parameter ``a``: + Incoming signal to the newly placed gate in `lyt`. + +Returns: + Signal pointing to the placed gate in `lyt`.)doc"; + +static const char *__doc_fiction_place_3 = +R"doc(Place 2-input gates. + +Template parameter ``Lyt``: + Gate-level layout type. + +Template parameter ``Ntk``: + Logic network type. + +Parameter ``lyt``: + Gate-level layout in which to place a 2-input gate. + +Parameter ``t``: + Tile in `lyt` to place the gate onto. + +Parameter ``ntk``: + Network whose node is to be placed. + +Parameter ``n``: + Node in `ntk` to place onto `t` in `lyt`. + +Parameter ``a``: + First incoming signal to the newly placed gate in `lyt`. + +Parameter ``b``: + Second incoming signal to the newly placed gate in `lyt`. + +Parameter ``c``: + Third optional incoming constant value signal to the newly placed + gate in `lyt`. Might change the gate function when set, e.g., from + a MAJ to an AND if `c == false`. + +Returns: + Signal pointing to the placed gate in `lyt`.)doc"; + +static const char *__doc_fiction_place_4 = +R"doc(Place 3-input gates. + +Template parameter ``Lyt``: + Gate-level layout type. + +Template parameter ``Ntk``: + Logic network type. + +Parameter ``lyt``: + Gate-level layout in which to place a 3-input gate. + +Parameter ``t``: + Tile in `lyt` to place the gate onto. + +Parameter ``ntk``: + Network whose node is to be placed. + +Parameter ``n``: + Node in `ntk` to place onto `t` in `lyt`. + +Parameter ``a``: + First incoming signal to the newly placed gate in `lyt`. + +Parameter ``b``: + Second incoming signal to the newly placed gate in `lyt`. + +Parameter ``c``: + Third incoming signal to the newly placed gate in `lyt`. + +Returns: + Signal pointing to the placed gate in `lyt`.)doc"; + +static const char *__doc_fiction_place_5 = +R"doc(Place any gate from a network. This function automatically identifies +the arity of the passed node and fetches its incoming signals from the +given network and a provided `mockturtle::node_map`. This function +does not update the `mockturtle::node_map`. + +Template parameter ``Lyt``: + Gate-level layout type. + +Template parameter ``Ntk``: + Logic network type. + +Parameter ``lyt``: + Gate-level layout in which to place any gate. + +Parameter ``t``: + Tile in `lyt` to place the gate onto. + +Parameter ``ntk``: + Network whose node is to be placed. + +Parameter ``n``: + Node in `ntk` to place onto `t` in `lyt`. + +Parameter ``node2pos``: + Mapping from network nodes to layout signals, i.e., a pointer to + their position in the layout. The map is used to fetch location of + the fanins. The `mockturtle::node_map` is not updated by this + function. + +Returns: + Signal to the newly placed gate in `lyt`.)doc"; + +static const char *__doc_fiction_place_6 = R"doc(Place any gate from a network. This function automatically identifies the arity of the passed node and fetches its incoming signals from the given network and a provided branching_signal_container @@ -19107,6 +19323,12 @@ static const char *__doc_fmt_formatter_parse = R"doc()doc"; static const char *__doc_fmt_formatter_parse_2 = R"doc()doc"; +static const char *__doc_fmt_unnamed_struct_at_home_runner_work_fiction_fiction_include_fiction_layouts_coordinates_hpp_1090_8 = R"doc()doc"; + +static const char *__doc_fmt_unnamed_struct_at_home_runner_work_fiction_fiction_include_fiction_layouts_coordinates_hpp_1106_8 = R"doc()doc"; + +static const char *__doc_fmt_unnamed_struct_at_home_runner_work_fiction_fiction_include_fiction_technology_cell_ports_hpp_291_8 = R"doc()doc"; + static const char *__doc_mockturtle_detail_foreach_element_if_transform = R"doc()doc"; static const char *__doc_mockturtle_edge = From d04cd5de9ec6ae9a497c7fdf38d519c3dd20306e Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Tue, 10 Dec 2024 12:11:17 +0100 Subject: [PATCH 41/42] :bug: Fixed many errors, warnings, and inconsistencies in the Python typing interface (still a long way to go) --- .../simulation/sidb/detect_bdl_pairs.hpp | 5 +- .../sidb/displacement_robustness_domain.hpp | 83 +- ...cupation_probability_of_excited_states.hpp | 2 +- .../simulation/sidb/operational_domain.hpp | 4 +- .../simulation/sidb/time_to_solution.hpp | 3 +- bindings/mnt/pyfiction/pyfiction.pyi | 1630 +++++++++++------ 6 files changed, 1162 insertions(+), 565 deletions(-) diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp index a3ac4f350..7880fc725 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/detect_bdl_pairs.hpp @@ -12,11 +12,10 @@ #include #include -#include #include #include -#include +#include namespace pyfiction { @@ -29,7 +28,7 @@ void detect_bdl_pairs(pybind11::module& m) { namespace py = pybind11; - m.def("detect_bdl_pairs", &fiction::detect_bdl_pairs, py::arg("lyt"), py::arg("type") = std::nullopt, + m.def("detect_bdl_pairs", &fiction::detect_bdl_pairs, py::arg("lyt"), py::arg("cell_type") = std::nullopt, py::arg("params") = fiction::detect_bdl_pairs_params{}, DOC(fiction_detect_bdl_pairs)); } diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp index c8c25ad5c..34c05f7b0 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/displacement_robustness_domain.hpp @@ -27,13 +27,17 @@ void determine_displacement_robustness_domain(pybind11::module& m, const std::st namespace py = pybind11; py::class_>( - m, fmt::format("displacement_robustness_domain{}", lattice).c_str()) + m, fmt::format("displacement_robustness_domain_{}", lattice).c_str(), + DOC(fiction_displacement_robustness_domain)) .def(py::init<>()) - .def_readwrite("operational_values", &fiction::displacement_robustness_domain::operational_values); + .def_readwrite("operational_values", &fiction::displacement_robustness_domain::operational_values, + DOC(fiction_displacement_robustness_domain_operational_values)) - m.def(fmt::format("determine_displacement_robustness_domain{}", lattice).c_str(), + ; + + m.def(fmt::format("determine_displacement_robustness_domain_{}", lattice).c_str(), &fiction::determine_displacement_robustness_domain, py::arg("layout"), py::arg("spec"), - py::arg("params"), py::arg("stats") = nullptr); + py::arg("params"), py::arg("stats") = nullptr, DOC(fiction_determine_displacement_robustness_domain)); } } // namespace detail @@ -43,49 +47,74 @@ inline void determine_displacement_robustness_domain(pybind11::module& m) namespace py = pybind11; py::enum_::dimer_displacement_policy>( - m, "dimer_displacement_policy") + m, "dimer_displacement_policy", DOC(fiction_displacement_robustness_domain_params_dimer_displacement_policy)) .value("STAY_ON_ORIGINAL_DIMER", fiction::displacement_robustness_domain_params< - fiction::offset::ucoord_t>::dimer_displacement_policy::STAY_ON_ORIGINAL_DIMER) - .value("ALLOW_OTHER_DIMER", fiction::displacement_robustness_domain_params< - fiction::offset::ucoord_t>::dimer_displacement_policy::ALLOW_OTHER_DIMER); + fiction::offset::ucoord_t>::dimer_displacement_policy::STAY_ON_ORIGINAL_DIMER, + DOC(fiction_displacement_robustness_domain_params_dimer_displacement_policy_STAY_ON_ORIGINAL_DIMER)) + .value("ALLOW_OTHER_DIMER", + fiction::displacement_robustness_domain_params< + fiction::offset::ucoord_t>::dimer_displacement_policy::ALLOW_OTHER_DIMER, + DOC(fiction_displacement_robustness_domain_params_dimer_displacement_policy_ALLOW_OTHER_DIMER)) + + ; py::enum_::displacement_analysis_mode>( - m, "displacement_analysis_mode") - .value("EXHAUSTIVE", fiction::displacement_robustness_domain_params< - fiction::offset::ucoord_t>::displacement_analysis_mode::EXHAUSTIVE) - .value("RANDOM", fiction::displacement_robustness_domain_params< - fiction::offset::ucoord_t>::displacement_analysis_mode::RANDOM); + m, "displacement_analysis_mode", DOC(fiction_displacement_robustness_domain_params_analysis_mode)) + .value("EXHAUSTIVE", + fiction::displacement_robustness_domain_params< + fiction::offset::ucoord_t>::displacement_analysis_mode::EXHAUSTIVE, + DOC(fiction_displacement_robustness_domain_params_displacement_analysis_mode_EXHAUSTIVE)) + .value("RANDOM", + fiction::displacement_robustness_domain_params< + fiction::offset::ucoord_t>::displacement_analysis_mode::RANDOM, + DOC(fiction_displacement_robustness_domain_params_displacement_analysis_mode_RANDOM)) + + ; py::class_>( - m, "displacement_robustness_domain_params") + m, "displacement_robustness_domain_params", DOC(fiction_displacement_robustness_domain_params)) .def(py::init<>()) .def_readwrite("analysis_mode", - &fiction::displacement_robustness_domain_params::analysis_mode) + &fiction::displacement_robustness_domain_params::analysis_mode, + DOC(fiction_displacement_robustness_domain_params_analysis_mode)) .def_readwrite("percentage_of_analyzed_displaced_layouts", &fiction::displacement_robustness_domain_params< - fiction::offset::ucoord_t>::percentage_of_analyzed_displaced_layouts) + fiction::offset::ucoord_t>::percentage_of_analyzed_displaced_layouts, + DOC(fiction_displacement_robustness_domain_params_percentage_of_analyzed_displaced_layouts)) .def_readwrite( "displacement_variations", - &fiction::displacement_robustness_domain_params::displacement_variations) - .def_readwrite("is_operational_params", - &fiction::displacement_robustness_domain_params::operational_params) + &fiction::displacement_robustness_domain_params::displacement_variations, + DOC(fiction_displacement_robustness_domain_params_displacement_variations)) + .def_readwrite("operational_params", + &fiction::displacement_robustness_domain_params::operational_params, + DOC(fiction_displacement_robustness_domain_params_operational_params)) .def_readwrite("fixed_sidbs", - &fiction::displacement_robustness_domain_params::fixed_sidbs) + &fiction::displacement_robustness_domain_params::fixed_sidbs, + DOC(fiction_displacement_robustness_domain_params_fixed_sidbs)) .def_readwrite("dimer_policy", - &fiction::displacement_robustness_domain_params::dimer_policy); + &fiction::displacement_robustness_domain_params::dimer_policy, + DOC(fiction_displacement_robustness_domain_params_dimer_policy)) - py::class_(m, "displacement_robustness_domain_stats") + ; + + py::class_(m, "displacement_robustness_domain_stats", + DOC(fiction_displacement_robustness_domain_stats)) .def(py::init<>()) - .def_readwrite("time_total", &fiction::displacement_robustness_domain_stats::time_total) + .def_readwrite("time_total", &fiction::displacement_robustness_domain_stats::time_total, + DOC(fiction_displacement_robustness_domain_stats_duration)) .def_readwrite("num_operational_sidb_displacements", - &fiction::displacement_robustness_domain_stats::num_operational_sidb_displacements) + &fiction::displacement_robustness_domain_stats::num_operational_sidb_displacements, + DOC(fiction_displacement_robustness_domain_stats_num_operational_sidb_displacements)) .def_readwrite("num_non_operational_sidb_displacements", - &fiction::displacement_robustness_domain_stats::num_non_operational_sidb_displacements); + &fiction::displacement_robustness_domain_stats::num_non_operational_sidb_displacements, + DOC(fiction_displacement_robustness_domain_stats_num_non_operational_sidb_displacements)) + + ; // NOTE: be careful with the order of the following calls! Python will resolve the first matching overload! - detail::determine_displacement_robustness_domain(m, "_100"); - detail::determine_displacement_robustness_domain(m, "_111"); + detail::determine_displacement_robustness_domain(m, "100"); + detail::determine_displacement_robustness_domain(m, "111"); } } // namespace pyfiction diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/occupation_probability_of_excited_states.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/occupation_probability_of_excited_states.hpp index adb7e42b1..93e657625 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/occupation_probability_of_excited_states.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/occupation_probability_of_excited_states.hpp @@ -18,7 +18,7 @@ namespace pyfiction namespace detail { -void occupation_probability_of_excited_states(pybind11::module& m) +inline void occupation_probability_of_excited_states(pybind11::module& m) { namespace py = pybind11; diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/operational_domain.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/operational_domain.hpp index 90176770a..93bcf9d54 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/operational_domain.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/operational_domain.hpp @@ -91,8 +91,8 @@ inline void operational_domain(pybind11::module& m) py::class_(m, "operational_domain_value_range", DOC(fiction_operational_domain_value_range)) .def(py::init(), py::arg("dimension")) - .def(py::init(), py::arg("dimension"), py::arg("min"), - py::arg("max"), py::arg("step")) + .def(py::init(), py::arg("dimension"), py::arg("minimum"), + py::arg("maximum"), py::arg("step")) .def_readwrite("dimension", &fiction::operational_domain_value_range::dimension, DOC(fiction_operational_domain_value_range_dimension)) .def_readwrite("min", &fiction::operational_domain_value_range::min, diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/time_to_solution.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/time_to_solution.hpp index e868dbaa6..e2bbb22f8 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/time_to_solution.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/simulation/sidb/time_to_solution.hpp @@ -11,7 +11,8 @@ #include #include -#include + +#include namespace pyfiction { diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index ca3034652..6ee92f43c 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -74,13 +74,12 @@ class siqad_coordinate: def __hash__(self) -> int: ... # For consistent behavior: +@overload def area(coord: offset_coordinate | cube_coordinate | siqad_coordinate) -> float: ... def volume(coord: offset_coordinate | cube_coordinate | siqad_coordinate) -> float: ... # For conversions with potentially nuanced behavior: -@overload def to_offset_coord(coord: siqad_coordinate) -> offset_coordinate: ... -@overload def to_cube_coord(coord: siqad_coordinate) -> cube_coordinate: ... @overload def to_siqad_coord(coord: offset_coordinate) -> siqad_coordinate: ... @@ -91,227 +90,456 @@ class cartesian_layout: @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: offset_coordinate) -> None: ... + def __init__(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... def coord(self, x: int, y: int, z: int = 0) -> offset_coordinate: ... def x(self) -> int: ... def y(self) -> int: ... def z(self) -> int: ... def area(self) -> int: ... - def resize(self, dimension: offset_coordinate) -> None: ... - def north(self, c: offset_coordinate) -> offset_coordinate | None: ... - def north_east(self, c: offset_coordinate) -> offset_coordinate | None: ... - def east(self, c: offset_coordinate) -> offset_coordinate | None: ... - def south_east(self, c: offset_coordinate) -> offset_coordinate | None: ... - def south(self, c: offset_coordinate) -> offset_coordinate | None: ... - def south_west(self, c: offset_coordinate) -> offset_coordinate | None: ... - def west(self, c: offset_coordinate) -> offset_coordinate | None: ... - def north_west(self, c: offset_coordinate) -> offset_coordinate | None: ... - def above(self, c: offset_coordinate) -> offset_coordinate | None: ... - def below(self, c: offset_coordinate) -> offset_coordinate | None: ... - def is_north_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_east_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_south_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_west_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_adjacent_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_adjacent_elevation_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_above(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_below(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_northwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_eastwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_southwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_westwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_at_northern_border(self, c: offset_coordinate) -> bool: ... - def is_at_eastern_border(self, c: offset_coordinate) -> bool: ... - def is_at_southern_border(self, c: offset_coordinate) -> bool: ... - def is_at_western_border(self, c: offset_coordinate) -> bool: ... - def is_at_any_border(self, c: offset_coordinate) -> bool: ... - def northern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... - def eastern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... - def southern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... - def western_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... - def is_ground_layer(self, c: offset_coordinate) -> bool: ... - def is_crossing_layer(self, c: offset_coordinate) -> bool: ... - def is_within_bounds(self, c: offset_coordinate) -> bool: ... + def resize(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def north(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def north_east(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def east(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def south_east(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def south(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def south_west(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def west(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def north_west(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def above(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def below(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def is_north_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_east_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_south_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_west_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_adjacent_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_adjacent_elevation_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_above( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_below( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_northwards_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_eastwards_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_southwards_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_westwards_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_at_northern_border(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_eastern_border(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_southern_border(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_western_border(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_any_border(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def northern_border_of( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> offset_coordinate | None: ... + def eastern_border_of( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> offset_coordinate | None: ... + def southern_border_of( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> offset_coordinate | None: ... + def western_border_of( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> offset_coordinate | None: ... + def is_ground_layer(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_crossing_layer(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_within_bounds(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def offset_coordinates(self) -> list[offset_coordinate]: ... def ground_coordinates(self) -> list[offset_coordinate]: ... - def adjacent_coordinates(self, c: offset_coordinate) -> list[offset_coordinate]: ... - def adjacent_opposite_coordinates(self, c: offset_coordinate) -> list[offset_coordinate]: ... + def adjacent_coordinates( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[offset_coordinate]: ... + def adjacent_opposite_coordinates( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[offset_coordinate]: ... class shifted_cartesian_layout: @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: offset_coordinate) -> None: ... + def __init__(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... def coord(self, x: int, y: int, z: int = 0) -> offset_coordinate: ... def x(self) -> int: ... def y(self) -> int: ... def z(self) -> int: ... def area(self) -> int: ... - def resize(self, dimension: offset_coordinate) -> None: ... - def north(self, c: offset_coordinate) -> offset_coordinate | None: ... - def north_east(self, c: offset_coordinate) -> offset_coordinate | None: ... - def east(self, c: offset_coordinate) -> offset_coordinate | None: ... - def south_east(self, c: offset_coordinate) -> offset_coordinate | None: ... - def south(self, c: offset_coordinate) -> offset_coordinate | None: ... - def south_west(self, c: offset_coordinate) -> offset_coordinate | None: ... - def west(self, c: offset_coordinate) -> offset_coordinate | None: ... - def north_west(self, c: offset_coordinate) -> offset_coordinate | None: ... - def above(self, c: offset_coordinate) -> offset_coordinate | None: ... - def below(self, c: offset_coordinate) -> offset_coordinate | None: ... - def is_north_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_east_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_south_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_west_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_adjacent_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_adjacent_elevation_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_above(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_below(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_northwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_eastwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_southwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_westwards_of(self, c1: offset_coordinate, c2: offset_coordinate) -> bool: ... - def is_at_northern_border(self, c: offset_coordinate) -> bool: ... - def is_at_eastern_border(self, c: offset_coordinate) -> bool: ... - def is_at_southern_border(self, c: offset_coordinate) -> bool: ... - def is_at_western_border(self, c: offset_coordinate) -> bool: ... - def is_at_any_border(self, c: offset_coordinate) -> bool: ... - def northern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... - def eastern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... - def southern_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... - def western_border_of(self, c: offset_coordinate) -> offset_coordinate | None: ... - def is_ground_layer(self, c: offset_coordinate) -> bool: ... - def is_crossing_layer(self, c: offset_coordinate) -> bool: ... - def is_within_bounds(self, c: offset_coordinate) -> bool: ... + def resize(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def north(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def north_east(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def east(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def south_east(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def south(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def south_west(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def west(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def north_west(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def above(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def below(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> offset_coordinate | None: ... + def is_north_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_east_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_south_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_west_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_adjacent_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_adjacent_elevation_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_above( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_below( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_northwards_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_eastwards_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_southwards_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_westwards_of( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_at_northern_border(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_eastern_border(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_southern_border(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_western_border(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_any_border(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def northern_border_of( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> offset_coordinate | None: ... + def eastern_border_of( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> offset_coordinate | None: ... + def southern_border_of( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> offset_coordinate | None: ... + def western_border_of( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> offset_coordinate | None: ... + def is_ground_layer(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_crossing_layer(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_within_bounds(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def offset_coordinates(self) -> list[offset_coordinate]: ... def ground_coordinates(self) -> list[offset_coordinate]: ... - def adjacent_coordinates(self, c: offset_coordinate) -> list[offset_coordinate]: ... - def adjacent_opposite_coordinates(self, c: offset_coordinate) -> list[offset_coordinate]: ... + def adjacent_coordinates( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[offset_coordinate]: ... + def adjacent_opposite_coordinates( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[offset_coordinate]: ... class hexagonal_layout: @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: cube_coordinate) -> None: ... + def __init__(self, dimension: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... def coord(self, x: int, y: int, z: int = 0) -> cube_coordinate: ... def x(self) -> int: ... def y(self) -> int: ... def z(self) -> int: ... def area(self) -> int: ... - def resize(self, dimension: cube_coordinate) -> None: ... - def north(self, c: cube_coordinate) -> cube_coordinate | None: ... - def north_east(self, c: cube_coordinate) -> cube_coordinate | None: ... - def east(self, c: cube_coordinate) -> cube_coordinate | None: ... - def south_east(self, c: cube_coordinate) -> cube_coordinate | None: ... - def south(self, c: cube_coordinate) -> cube_coordinate | None: ... - def south_west(self, c: cube_coordinate) -> cube_coordinate | None: ... - def west(self, c: cube_coordinate) -> cube_coordinate | None: ... - def north_west(self, c: cube_coordinate) -> cube_coordinate | None: ... - def above(self, c: cube_coordinate) -> cube_coordinate | None: ... - def below(self, c: cube_coordinate) -> cube_coordinate | None: ... - def is_north_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_east_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_south_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_west_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_adjacent_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_adjacent_elevation_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_above(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_below(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_northwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_eastwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_southwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_westwards_of(self, c1: cube_coordinate, c2: cube_coordinate) -> bool: ... - def is_at_northern_border(self, c: cube_coordinate) -> bool: ... - def is_at_eastern_border(self, c: cube_coordinate) -> bool: ... - def is_at_southern_border(self, c: cube_coordinate) -> bool: ... - def is_at_western_border(self, c: cube_coordinate) -> bool: ... - def is_at_any_border(self, c: cube_coordinate) -> bool: ... - def northern_border_of(self, c: cube_coordinate) -> cube_coordinate | None: ... - def eastern_border_of(self, c: cube_coordinate) -> cube_coordinate | None: ... - def southern_border_of(self, c: cube_coordinate) -> cube_coordinate | None: ... - def western_border_of(self, c: cube_coordinate) -> cube_coordinate | None: ... - def is_ground_layer(self, c: cube_coordinate) -> bool: ... - def is_crossing_layer(self, c: cube_coordinate) -> bool: ... - def is_within_bounds(self, c: cube_coordinate) -> bool: ... + def resize(self, dimension: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def north(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> cube_coordinate | None: ... + def north_east(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> cube_coordinate | None: ... + def east(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> cube_coordinate | None: ... + def south_east(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> cube_coordinate | None: ... + def south(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> cube_coordinate | None: ... + def south_west(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> cube_coordinate | None: ... + def west(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> cube_coordinate | None: ... + def north_west(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> cube_coordinate | None: ... + def above(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> cube_coordinate | None: ... + def below(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> cube_coordinate | None: ... + def is_north_of( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_east_of( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_south_of( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_west_of( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_adjacent_of( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_adjacent_elevation_of( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_above( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_below( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_northwards_of( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_eastwards_of( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_southwards_of( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_westwards_of( + self, + c1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + c2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_at_northern_border(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_eastern_border(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_southern_border(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_western_border(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_at_any_border(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def northern_border_of( + self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> cube_coordinate | None: ... + def eastern_border_of( + self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> cube_coordinate | None: ... + def southern_border_of( + self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> cube_coordinate | None: ... + def western_border_of( + self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> cube_coordinate | None: ... + def is_ground_layer(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_crossing_layer(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_within_bounds(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def coordinates(self) -> list[cube_coordinate]: ... def ground_coordinates(self) -> list[cube_coordinate]: ... - def adjacent_coordinates(self, c: cube_coordinate) -> list[cube_coordinate]: ... - def adjacent_opposite_coordinates(self, c: cube_coordinate) -> list[cube_coordinate]: ... + def adjacent_coordinates( + self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[cube_coordinate]: ... + def adjacent_opposite_coordinates( + self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[cube_coordinate]: ... class clocked_cartesian_layout(cartesian_layout): @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: offset_coordinate) -> None: ... + def __init__(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... @overload - def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave") -> None: ... - def assign_clock_number(self, cz: offset_coordinate, cn: int) -> None: ... - def get_clock_number(self, cz: offset_coordinate) -> int: ... + def __init__( + self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], clocking_scheme: str = "2DDWave" + ) -> None: ... + def assign_clock_number(self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int], cn: int) -> None: ... + def get_clock_number(self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... def num_clocks(self) -> int: ... def is_regularly_clocked(self) -> bool: ... def is_clocking_scheme(self, name: str) -> bool: ... - def is_incoming_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... - def is_outgoing_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... - def incoming_clocked_zones(self, cz: offset_coordinate) -> list[offset_coordinate]: ... - def outgoing_clocked_zones(self, cz: offset_coordinate) -> list[offset_coordinate]: ... - def in_degree(self, cz: offset_coordinate) -> int: ... - def out_degree(self, cz: offset_coordinate) -> int: ... - def degree(self, cz: offset_coordinate) -> int: ... + def is_incoming_clocked( + self, + cz1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + cz2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_outgoing_clocked( + self, + cz1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + cz2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def incoming_clocked_zones( + self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[offset_coordinate]: ... + def outgoing_clocked_zones( + self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[offset_coordinate]: ... + def in_degree(self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... + def out_degree(self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... + def degree(self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... class clocked_shifted_cartesian_layout(shifted_cartesian_layout): @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: offset_coordinate) -> None: ... + def __init__(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... @overload - def __init__(self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave") -> None: ... - def assign_clock_number(self, cz: offset_coordinate, cn: int) -> None: ... - def get_clock_number(self, cz: offset_coordinate) -> int: ... + def __init__( + self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], clocking_scheme: str = "2DDWave" + ) -> None: ... + def assign_clock_number(self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int], cn: int) -> None: ... + def get_clock_number(self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... def num_clocks(self) -> int: ... def is_regularly_clocked(self) -> bool: ... def is_clocking_scheme(self, name: str) -> bool: ... - def is_incoming_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... - def is_outgoing_clocked(self, cz1: offset_coordinate, cz2: offset_coordinate) -> bool: ... - def incoming_clocked_zones(self, cz: offset_coordinate) -> list[offset_coordinate]: ... - def outgoing_clocked_zones(self, cz: offset_coordinate) -> list[offset_coordinate]: ... - def in_degree(self, cz: offset_coordinate) -> int: ... - def out_degree(self, cz: offset_coordinate) -> int: ... - def degree(self, cz: offset_coordinate) -> int: ... + def is_incoming_clocked( + self, + cz1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + cz2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_outgoing_clocked( + self, + cz1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + cz2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def incoming_clocked_zones( + self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[offset_coordinate]: ... + def outgoing_clocked_zones( + self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[offset_coordinate]: ... + def in_degree(self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... + def out_degree(self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... + def degree(self, cz: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... class clocked_hexagonal_layout(hexagonal_layout): @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: cube_coordinate) -> None: ... + def __init__(self, dimension: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... @overload - def __init__(self, dimension: cube_coordinate, clocking_scheme: str = "2DDWave") -> None: ... - def assign_clock_number(self, cz: cube_coordinate, cn: int) -> None: ... - def get_clock_number(self, cz: cube_coordinate) -> int: ... + def __init__( + self, dimension: cube_coordinate | tuple[int, int] | tuple[int, int, int], clocking_scheme: str = "2DDWave" + ) -> None: ... + def assign_clock_number(self, cz: cube_coordinate | tuple[int, int] | tuple[int, int, int], cn: int) -> None: ... + def get_clock_number(self, cz: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... def num_clocks(self) -> int: ... def is_regularly_clocked(self) -> bool: ... def is_clocking_scheme(self, name: str) -> bool: ... - def is_incoming_clocked(self, cz1: cube_coordinate, cz2: cube_coordinate) -> bool: ... - def is_outgoing_clocked(self, cz1: cube_coordinate, cz2: cube_coordinate) -> bool: ... - def incoming_clocked_zones(self, cz: cube_coordinate) -> list[cube_coordinate]: ... - def outgoing_clocked_zones(self, cz: cube_coordinate) -> list[cube_coordinate]: ... - def in_degree(self, cz: cube_coordinate) -> int: ... - def out_degree(self, cz: cube_coordinate) -> int: ... - def degree(self, cz: cube_coordinate) -> int: ... + def is_incoming_clocked( + self, + cz1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + cz2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def is_outgoing_clocked( + self, + cz1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + cz2: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def incoming_clocked_zones( + self, cz: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[cube_coordinate]: ... + def outgoing_clocked_zones( + self, cz: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> list[cube_coordinate]: ... + def in_degree(self, cz: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... + def out_degree(self, cz: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... + def degree(self, cz: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... class cartesian_gate_layout(clocked_cartesian_layout): @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: offset_coordinate) -> None: ... + def __init__(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, + dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], + clocking_scheme: str = "2DDWave", + layout_name: str = "", + ) -> None: ... + def create_pi( + self, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_po( + self, s: int, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None ) -> None: ... - def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... - def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... def is_pi(self, n: int) -> bool: ... def is_po(self, n: int) -> bool: ... - def is_pi_coordinate(self, t: offset_coordinate) -> bool: ... - def is_po_coordinate(self, t: offset_coordinate) -> bool: ... + def is_pi_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_po_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def is_inv(self) -> bool: ... def is_and(self) -> bool: ... def is_nand(self) -> bool: ... @@ -330,15 +558,33 @@ class cartesian_gate_layout(clocked_cartesian_layout): def set_output_name(self, index: int, name: str) -> None: ... def get_output_name(self, index: int) -> str: ... def get_name(self, s: int) -> str: ... - def create_buf(self, a: int, t: offset_coordinate | None = None) -> None: ... - def create_not(self, a: int, t: offset_coordinate | None = None) -> None: ... - def create_and(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_nand(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_or(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_nor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_xor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_xnor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_maj(self, a: int, b: int, c: int, t: offset_coordinate | None = None) -> None: ... + def create_buf( + self, a: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_not( + self, a: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_and( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_nand( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_or( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_nor( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_xor( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_xnor( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_maj( + self, a: int, b: int, c: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... def num_pis(self) -> int: ... def num_pos(self) -> int: ... def num_gates(self) -> int: ... @@ -347,40 +593,60 @@ class cartesian_gate_layout(clocked_cartesian_layout): def is_empty(self) -> bool: ... def fanin_size(self, n: int) -> int: ... def fanout_size(self, n: int) -> int: ... - def get_int(self, t: offset_coordinate) -> int: ... - def get_coordinate(self, n: int) -> offset_coordinate: ... - def make_int(self, n: int) -> int: ... - def move_int(self, n: int, t: offset_coordinate, new_children: list[offset_coordinate] = []) -> None: ... - def clear_coordinate(self, t: offset_coordinate) -> None: ... - def is_gate_coordinate(self, t: offset_coordinate) -> bool: ... - def is_wire_coordinate(self, t: offset_coordinate) -> bool: ... - def is_empty_coordinate(self, t: offset_coordinate) -> bool: ... + def get_tile(self, n: int) -> int: ... + def make_signal(self, n: int) -> int: ... + def move_node( + self, + n: int, + t: offset_coordinate | tuple[int, int] | tuple[int, int, int], + new_children: list[offset_coordinate] = [], + ) -> None: ... + def clear_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def is_gate_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_wire_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_empty_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def pis(self) -> list[offset_coordinate]: ... def pos(self) -> list[offset_coordinate]: ... def gates(self) -> list[offset_coordinate]: ... def wires(self) -> list[offset_coordinate]: ... - def fanins(self, t: offset_coordinate) -> list[int]: ... - def fanouts(self, t: offset_coordinate) -> list[int]: ... - def is_incoming_int(self, t: offset_coordinate, s: int) -> bool: ... - def has_no_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_northern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_north_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_south_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_southern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_south_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_north_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def is_outgoing_int(self, t: offset_coordinate, s: int) -> bool: ... - def has_no_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_northern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_north_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_south_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_southern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_south_western_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_western_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_north_western_outgoing_int(self, t: offset_coordinate) -> bool: ... + def fanins(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> list[int]: ... + def fanouts(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> list[int]: ... + def is_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int], s: int) -> bool: ... + def has_no_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_northern_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_eastern_incoming_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_eastern_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_eastern_incoming_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_southern_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_western_incoming_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_western_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_western_incoming_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def is_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int], s: int) -> bool: ... + def has_no_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_northern_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_eastern_outgoing_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_eastern_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_eastern_outgoing_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_southern_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_western_outgoing_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_western_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_western_outgoing_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... def bounding_box_2d(self) -> tuple[offset_coordinate, offset_coordinate]: ... def is_dead(self, n: int) -> bool: ... @@ -388,17 +654,24 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: offset_coordinate) -> None: ... + def __init__(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, + dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], + clocking_scheme: str = "2DDWave", + layout_name: str = "", + ) -> None: ... + def create_pi( + self, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_po( + self, s: int, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None ) -> None: ... - def create_pi(self, name: str = "", t: offset_coordinate | None = None) -> None: ... - def create_po(self, s: int, name: str = "", t: offset_coordinate | None = None) -> None: ... def is_pi(self, n: int) -> bool: ... def is_po(self, n: int) -> bool: ... - def is_pi_coordinate(self, t: offset_coordinate) -> bool: ... - def is_po_coordinate(self, t: offset_coordinate) -> bool: ... + def is_pi_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_po_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def is_inv(self) -> bool: ... def is_and(self) -> bool: ... def is_nand(self) -> bool: ... @@ -416,15 +689,33 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): def set_output_name(self, index: int, name: str) -> None: ... def get_output_name(self, index: int) -> str: ... def get_name(self, s: int) -> str: ... - def create_buf(self, a: int, t: offset_coordinate | None = None) -> None: ... - def create_not(self, a: int, t: offset_coordinate | None = None) -> None: ... - def create_and(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_nand(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_or(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_nor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_xor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_xnor(self, a: int, b: int, t: offset_coordinate | None = None) -> None: ... - def create_maj(self, a: int, b: int, c: int, t: offset_coordinate | None = None) -> None: ... + def create_buf( + self, a: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_not( + self, a: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_and( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_nand( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_or( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_nor( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_xor( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_xnor( + self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_maj( + self, a: int, b: int, c: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... def num_pis(self) -> int: ... def num_pos(self) -> int: ... def num_gates(self) -> int: ... @@ -433,40 +724,61 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): def is_empty(self) -> bool: ... def fanin_size(self, n: int) -> int: ... def fanout_size(self, n: int) -> int: ... - def get_int(self, t: offset_coordinate) -> int: ... + def get_tile(self, n: int) -> int: ... def get_coordinate(self, n: int) -> offset_coordinate: ... - def make_int(self, n: int) -> int: ... - def move_int(self, n: int, t: offset_coordinate, new_children: list[offset_coordinate] = []) -> None: ... - def clear_coordinate(self, t: offset_coordinate) -> None: ... - def is_gate_coordinate(self, t: offset_coordinate) -> bool: ... - def is_wire_coordinate(self, t: offset_coordinate) -> bool: ... - def is_empty_coordinate(self, t: offset_coordinate) -> bool: ... + def make_signal(self, n: int) -> int: ... + def move_node( + self, + n: int, + t: offset_coordinate | tuple[int, int] | tuple[int, int, int], + new_children: list[offset_coordinate] = [], + ) -> None: ... + def clear_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def is_gate_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_wire_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_empty_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def pis(self) -> list[offset_coordinate]: ... def pos(self) -> list[offset_coordinate]: ... def gates(self) -> list[offset_coordinate]: ... def wires(self) -> list[offset_coordinate]: ... - def fanins(self, t: offset_coordinate) -> list[int]: ... - def fanouts(self, t: offset_coordinate) -> list[int]: ... - def is_incoming_int(self, t: offset_coordinate, s: int) -> bool: ... - def has_no_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_northern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_north_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_south_eastern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_southern_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_south_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def has_north_western_incoming_int(self, t: offset_coordinate) -> bool: ... - def is_outgoing_int(self, t: offset_coordinate, s: int) -> bool: ... - def has_no_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_northern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_north_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_south_eastern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_southern_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_south_western_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_western_outgoing_int(self, t: offset_coordinate) -> bool: ... - def has_north_western_outgoing_int(self, t: offset_coordinate) -> bool: ... + def fanins(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> list[int]: ... + def fanouts(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> list[int]: ... + def is_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int], s: int) -> bool: ... + def has_no_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_northern_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_eastern_incoming_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_eastern_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_eastern_incoming_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_southern_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_western_incoming_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_western_incoming_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_western_incoming_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def is_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int], s: int) -> bool: ... + def has_no_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_northern_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_eastern_outgoing_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_eastern_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_eastern_outgoing_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_southern_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_western_outgoing_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_western_outgoing_signal(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_western_outgoing_signal( + self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... def bounding_box_2d(self) -> tuple[offset_coordinate, offset_coordinate]: ... def is_dead(self, n: int) -> bool: ... @@ -474,15 +786,24 @@ class hexagonal_gate_layout(clocked_hexagonal_layout): @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: cube_coordinate) -> None: ... + def __init__(self, dimension: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... @overload - def __init__(self, dimension: cube_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "") -> None: ... - def create_pi(self, name: str = "", t: cube_coordinate | None = None) -> None: ... - def create_po(self, s: int, name: str = "", t: cube_coordinate | None = None) -> None: ... + def __init__( + self, + dimension: cube_coordinate | tuple[int, int] | tuple[int, int, int], + clocking_scheme: str = "2DDWave", + layout_name: str = "", + ) -> None: ... + def create_pi( + self, name: str = "", t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_po( + self, s: int, name: str = "", t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... def is_pi(self, n: int) -> bool: ... def is_po(self, n: int) -> bool: ... - def is_pi_coordinate(self, t: cube_coordinate) -> bool: ... - def is_po_coordinate(self, t: cube_coordinate) -> bool: ... + def is_pi_coordinate(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_po_coordinate(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def is_inv(self) -> bool: ... def is_and(self) -> bool: ... def is_nand(self) -> bool: ... @@ -500,15 +821,29 @@ class hexagonal_gate_layout(clocked_hexagonal_layout): def set_output_name(self, index: int, name: str) -> None: ... def get_output_name(self, index: int) -> str: ... def get_name(self, s: int) -> str: ... - def create_buf(self, a: int, t: cube_coordinate | None = None) -> None: ... - def create_not(self, a: int, t: cube_coordinate | None = None) -> None: ... - def create_and(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... - def create_nand(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... - def create_or(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... - def create_nor(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... - def create_xor(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... - def create_xnor(self, a: int, b: int, t: cube_coordinate | None = None) -> None: ... - def create_maj(self, a: int, b: int, c: int, t: cube_coordinate | None = None) -> None: ... + def create_buf(self, a: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None) -> None: ... + def create_not(self, a: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None) -> None: ... + def create_and( + self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_nand( + self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_or( + self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_nor( + self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_xor( + self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_xnor( + self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... + def create_maj( + self, a: int, b: int, c: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None + ) -> None: ... def num_pis(self) -> int: ... def num_pos(self) -> int: ... def num_gates(self) -> int: ... @@ -517,40 +852,61 @@ class hexagonal_gate_layout(clocked_hexagonal_layout): def is_empty(self) -> bool: ... def fanin_size(self, n: int) -> int: ... def fanout_size(self, n: int) -> int: ... - def get_int(self, t: cube_coordinate) -> int: ... + def get_tile(self, n: int) -> int: ... def get_coordinate(self, n: int) -> cube_coordinate: ... - def make_int(self, n: int) -> int: ... - def move_int(self, n: int, t: cube_coordinate, new_children: list[cube_coordinate] = []) -> None: ... - def clear_coordinate(self, t: cube_coordinate) -> None: ... - def is_gate_coordinate(self, t: cube_coordinate) -> bool: ... - def is_wire_coordinate(self, t: cube_coordinate) -> bool: ... - def is_empty_coordinate(self, t: cube_coordinate) -> bool: ... + def make_signal(self, n: int) -> int: ... + def move_node( + self, + n: int, + t: cube_coordinate | tuple[int, int] | tuple[int, int, int], + new_children: list[cube_coordinate] = [], + ) -> None: ... + def clear_coordinate(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def is_gate_coordinate(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_wire_coordinate(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_empty_coordinate(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def pis(self) -> list[cube_coordinate]: ... def pos(self) -> list[cube_coordinate]: ... def gates(self) -> list[cube_coordinate]: ... def wires(self) -> list[cube_coordinate]: ... - def fanins(self, t: cube_coordinate) -> list[int]: ... - def fanouts(self, t: cube_coordinate) -> list[int]: ... - def is_incoming_int(self, t: cube_coordinate, s: int) -> bool: ... - def has_no_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_northern_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_north_eastern_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_eastern_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_south_eastern_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_southern_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_south_western_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_western_incoming_int(self, t: cube_coordinate) -> bool: ... - def has_north_western_incoming_int(self, t: cube_coordinate) -> bool: ... - def is_outgoing_int(self, t: cube_coordinate, s: int) -> bool: ... - def has_no_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_northern_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_north_eastern_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_eastern_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_south_eastern_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_southern_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_south_western_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_western_outgoing_int(self, t: cube_coordinate) -> bool: ... - def has_north_western_outgoing_int(self, t: cube_coordinate) -> bool: ... + def fanins(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> list[int]: ... + def fanouts(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> list[int]: ... + def is_incoming_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int], s: int) -> bool: ... + def has_no_incoming_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_northern_incoming_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_eastern_incoming_signal( + self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_eastern_incoming_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_eastern_incoming_signal( + self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_southern_incoming_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_western_incoming_signal( + self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_western_incoming_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_western_incoming_signal( + self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def is_outgoing_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int], s: int) -> bool: ... + def has_no_outgoing_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_northern_outgoing_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_eastern_outgoing_signal( + self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_eastern_outgoing_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_eastern_outgoing_signal( + self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_southern_outgoing_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_south_western_outgoing_signal( + self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... + def has_western_outgoing_signal(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def has_north_western_outgoing_signal( + self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> bool: ... def bounding_box_2d(self) -> tuple[cube_coordinate, cube_coordinate]: ... def is_dead(self, n: int) -> bool: ... @@ -559,12 +915,24 @@ class cartesian_obstruction_layout(cartesian_gate_layout): def __init__(self) -> None: ... @overload def __init__(self, layout: cartesian_gate_layout) -> None: ... - def obstruct_coordinate(self, c: offset_coordinate) -> None: ... - def obstruct_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... - def is_obstructed_coordinate(self, c: offset_coordinate) -> bool: ... - def is_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> bool: ... - def clear_obstructed_coordinate(self, c: offset_coordinate) -> None: ... - def clear_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... + def obstruct_coordinate(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def obstruct_connection( + self, + src: offset_coordinate | tuple[int, int] | tuple[int, int, int], + tgt: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> None: ... + def is_obstructed_coordinate(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_obstructed_connection( + self, + src: offset_coordinate | tuple[int, int] | tuple[int, int, int], + tgt: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def clear_obstructed_coordinate(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def clear_obstructed_connection( + self, + src: offset_coordinate | tuple[int, int] | tuple[int, int, int], + tgt: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> None: ... def clear_obstructed_coordinates(self) -> None: ... def clear_obstructed_connections(self) -> None: ... @@ -573,12 +941,24 @@ class shifted_cartesian_obstruction_layout(shifted_cartesian_gate_layout): def __init__(self) -> None: ... @overload def __init__(self, layout: shifted_cartesian_gate_layout) -> None: ... - def obstruct_coordinate(self, c: offset_coordinate) -> None: ... - def obstruct_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... - def is_obstructed_coordinate(self, c: offset_coordinate) -> bool: ... - def is_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> bool: ... - def clear_obstructed_coordinate(self, c: offset_coordinate) -> None: ... - def clear_obstructed_connection(self, src: offset_coordinate, tgt: offset_coordinate) -> None: ... + def obstruct_coordinate(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def obstruct_connection( + self, + src: offset_coordinate | tuple[int, int] | tuple[int, int, int], + tgt: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> None: ... + def is_obstructed_coordinate(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_obstructed_connection( + self, + src: offset_coordinate | tuple[int, int] | tuple[int, int, int], + tgt: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def clear_obstructed_coordinate(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def clear_obstructed_connection( + self, + src: offset_coordinate | tuple[int, int] | tuple[int, int, int], + tgt: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> None: ... def clear_obstructed_coordinates(self) -> None: ... def clear_obstructed_connections(self) -> None: ... @@ -587,12 +967,24 @@ class hexagonal_obstruction_layout(hexagonal_gate_layout): def __init__(self) -> None: ... @overload def __init__(self, layout: hexagonal_gate_layout) -> None: ... - def obstruct_coordinate(self, c: cube_coordinate) -> None: ... - def obstruct_connection(self, src: cube_coordinate, tgt: cube_coordinate) -> None: ... - def is_obstructed_coordinate(self, c: cube_coordinate) -> bool: ... - def is_obstructed_connection(self, src: cube_coordinate, tgt: cube_coordinate) -> bool: ... - def clear_obstructed_coordinate(self, c: cube_coordinate) -> None: ... - def clear_obstructed_connection(self, src: cube_coordinate, tgt: cube_coordinate) -> None: ... + def obstruct_coordinate(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def obstruct_connection( + self, + src: cube_coordinate | tuple[int, int] | tuple[int, int, int], + tgt: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> None: ... + def is_obstructed_coordinate(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_obstructed_connection( + self, + src: cube_coordinate | tuple[int, int] | tuple[int, int, int], + tgt: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> bool: ... + def clear_obstructed_coordinate(self, c: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... + def clear_obstructed_connection( + self, + src: cube_coordinate | tuple[int, int] | tuple[int, int, int], + tgt: cube_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> None: ... def clear_obstructed_coordinates(self) -> None: ... def clear_obstructed_connections(self) -> None: ... @@ -629,24 +1021,31 @@ class qca_layout(clocked_cartesian_layout): @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: offset_coordinate) -> None: ... + def __init__(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, + dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], + clocking_scheme: str = "2DDWave", + layout_name: str = "", + ) -> None: ... + def assign_cell_type( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int], ct: qca_technology.cell_type ) -> None: ... - def assign_cell_type(self, c: offset_coordinate, ct: qca_technology.cell_type) -> None: ... - def get_cell_type(self, c: offset_coordinate) -> qca_technology.cell_type: ... - def is_empty_cell(self, c: offset_coordinate) -> bool: ... - def assign_cell_name(self, c: offset_coordinate, n: str) -> None: ... - def get_cell_name(self, c: offset_coordinate) -> str | None: ... + def get_cell_type( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> qca_technology.cell_type: ... + def is_empty_cell(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def assign_cell_name(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int], n: str) -> None: ... + def get_cell_name(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> str | None: ... def set_layout_name(self, name: str) -> None: ... def get_layout_name(self) -> str: ... def num_cells(self) -> int: ... def is_empty(self) -> bool: ... def num_pis(self) -> int: ... def num_pos(self) -> int: ... - def is_pi(self, c: offset_coordinate) -> bool: ... - def is_po(self, c: offset_coordinate) -> bool: ... + def is_pi(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_po(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def cells(self) -> list[offset_coordinate]: ... def pis(self) -> list[offset_coordinate]: ... def pos(self) -> list[offset_coordinate]: ... @@ -656,24 +1055,31 @@ class inml_layout(clocked_cartesian_layout): @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: offset_coordinate) -> None: ... + def __init__(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, + dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], + clocking_scheme: str = "2DDWave", + layout_name: str = "", + ) -> None: ... + def assign_cell_type( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int], ct: inml_technology.cell_type ) -> None: ... - def assign_cell_type(self, c: offset_coordinate, ct: inml_technology.cell_type) -> None: ... - def get_cell_type(self, c: offset_coordinate) -> inml_technology.cell_type: ... - def is_empty_cell(self, c: offset_coordinate) -> bool: ... - def assign_cell_name(self, c: offset_coordinate, n: str) -> None: ... - def get_cell_name(self, c: offset_coordinate) -> str | None: ... + def get_cell_type( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> inml_technology.cell_type: ... + def is_empty_cell(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def assign_cell_name(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int], n: str) -> None: ... + def get_cell_name(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> str | None: ... def set_layout_name(self, name: str) -> None: ... def get_layout_name(self) -> str: ... def num_cells(self) -> int: ... def is_empty(self) -> bool: ... def num_pis(self) -> int: ... def num_pos(self) -> int: ... - def is_pi(self, c: offset_coordinate) -> bool: ... - def is_po(self, c: offset_coordinate) -> bool: ... + def is_pi(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_po(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def cells(self) -> list[offset_coordinate]: ... def pis(self) -> list[offset_coordinate]: ... def pos(self) -> list[offset_coordinate]: ... @@ -683,34 +1089,45 @@ class sidb_layout(clocked_cartesian_layout): @overload def __init__(self) -> None: ... @overload - def __init__(self, dimension: offset_coordinate) -> None: ... + def __init__(self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... @overload def __init__( - self, dimension: offset_coordinate, clocking_scheme: str = "2DDWave", layout_name: str = "" + self, + dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], + clocking_scheme: str = "2DDWave", + layout_name: str = "", + ) -> None: ... + def assign_cell_type( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int], ct: sidb_technology.cell_type ) -> None: ... - def assign_cell_type(self, c: offset_coordinate, ct: sidb_technology.cell_type) -> None: ... - def get_cell_type(self, c: offset_coordinate) -> sidb_technology.cell_type: ... - def is_empty_cell(self, c: offset_coordinate) -> bool: ... - def assign_cell_name(self, c: offset_coordinate, n: str) -> None: ... - def get_cell_name(self, c: offset_coordinate) -> str | None: ... + def get_cell_type( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> sidb_technology.cell_type: ... + def is_empty_cell(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def assign_cell_name(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int], n: str) -> None: ... + def get_cell_name(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> str | None: ... def set_layout_name(self, name: str) -> None: ... def get_layout_name(self) -> str: ... def num_cells(self) -> int: ... def is_empty(self) -> bool: ... def num_pis(self) -> int: ... def num_pos(self) -> int: ... - def is_pi(self, c: offset_coordinate) -> bool: ... - def is_po(self, c: offset_coordinate) -> bool: ... + def is_pi(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... + def is_po(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def cells(self) -> list[offset_coordinate]: ... def pis(self) -> list[offset_coordinate]: ... def pos(self) -> list[offset_coordinate]: ... def bounding_box_2d(self) -> tuple[offset_coordinate, offset_coordinate]: ... -class sidb_100_lattice: - def __init__(self, dimension: offset_coordinate, name: str = "") -> None: ... +class sidb_100_lattice(sidb_layout): + def __init__( + self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], name: str = "" + ) -> None: ... -class sidb_111_lattice: - def __init__(self, dimension: offset_coordinate, name: str = "") -> None: ... +class sidb_111_lattice(sidb_layout): + def __init__( + self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], name: str = "" + ) -> None: ... # Networks @@ -727,25 +1144,25 @@ class technology_network: def gates(self) -> list[technology_network_node]: ... def pis(self) -> list[technology_network_node]: ... def pos(self) -> list[technology_network_node]: ... - def fanins(self, n: technology_network_node) -> list[technology_network_node]: ... - def is_constant(self, n: technology_network_node) -> bool: ... - def is_pi(self, n: technology_network_node) -> bool: ... - def is_po(self, n: technology_network_node) -> bool: ... - def is_buf(self, n: technology_network_node) -> bool: ... - def is_fanout(self, n: technology_network_node) -> bool: ... - def is_inv(self, n: technology_network_node) -> bool: ... - def is_and(self, n: technology_network_node) -> bool: ... - def is_or(self, n: technology_network_node) -> bool: ... - def is_xor(self, n: technology_network_node) -> bool: ... - def is_maj(self, n: technology_network_node) -> bool: ... - def is_nand(self, n: technology_network_node) -> bool: ... - def is_nor(self, n: technology_network_node) -> bool: ... - def is_xnor(self, n: technology_network_node) -> bool: ... - def has_name(self, n: technology_network_node) -> bool: ... - def get_name(self, n: technology_network_node) -> str | None: ... + def fanins(self, n: technology_network_node | int) -> list[technology_network_node]: ... + def is_constant(self, n: technology_network_node | int) -> bool: ... + def is_pi(self, n: technology_network_node | int) -> bool: ... + def is_po(self, n: technology_network_node | int) -> bool: ... + def is_buf(self, n: technology_network_node | int) -> bool: ... + def is_fanout(self, n: technology_network_node | int) -> bool: ... + def is_inv(self, n: technology_network_node | int) -> bool: ... + def is_and(self, n: technology_network_node | int) -> bool: ... + def is_or(self, n: technology_network_node | int) -> bool: ... + def is_xor(self, n: technology_network_node | int) -> bool: ... + def is_maj(self, n: technology_network_node | int) -> bool: ... + def is_nand(self, n: technology_network_node | int) -> bool: ... + def is_nor(self, n: technology_network_node | int) -> bool: ... + def is_xnor(self, n: technology_network_node | int) -> bool: ... + def has_name(self, n: technology_network_node | int) -> bool: ... + def get_name(self, n: technology_network_node | int) -> str | None: ... def has_output_name(self, index: int) -> bool: ... def get_output_name(self, index: int) -> str | None: ... - def po_index(self, n: technology_network_node) -> int: ... + def po_index(self, n: technology_network_node | int) -> int: ... def po_at(self, index: int) -> technology_network_node: ... def read_technology_network(filename: str) -> technology_network: ... @@ -829,34 +1246,64 @@ def technology_mapping( @overload def manhattan_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, + source: offset_coordinate | tuple[int, int] | tuple[int, int, int], + target: offset_coordinate | tuple[int, int] | tuple[int, int, int], ) -> int: ... @overload -def manhattan_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... +def manhattan_distance( + layout: hexagonal_layout, + source: cube_coordinate | tuple[int, int] | tuple[int, int, int], + target: cube_coordinate | tuple[int, int] | tuple[int, int, int], +) -> int: ... @overload def euclidean_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, + source: offset_coordinate | tuple[int, int] | tuple[int, int, int], + target: offset_coordinate | tuple[int, int] | tuple[int, int, int], ) -> float: ... @overload -def euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... +def euclidean_distance( + layout: hexagonal_layout, + source: cube_coordinate | tuple[int, int] | tuple[int, int, int], + target: cube_coordinate | tuple[int, int] | tuple[int, int, int], +) -> float: ... @overload def squared_euclidean_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, + source: offset_coordinate | tuple[int, int] | tuple[int, int, int], + target: offset_coordinate | tuple[int, int] | tuple[int, int, int], ) -> float: ... @overload -def squared_euclidean_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> float: ... +def squared_euclidean_distance( + layout: hexagonal_layout, + source: cube_coordinate | tuple[int, int] | tuple[int, int, int], + target: cube_coordinate | tuple[int, int] | tuple[int, int, int], +) -> float: ... @overload def twoddwave_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, + source: offset_coordinate | tuple[int, int] | tuple[int, int, int], + target: offset_coordinate | tuple[int, int] | tuple[int, int, int], ) -> int: ... @overload -def twoddwave_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... +def twoddwave_distance( + layout: hexagonal_layout, + source: cube_coordinate | tuple[int, int] | tuple[int, int, int], + target: cube_coordinate | tuple[int, int] | tuple[int, int, int], +) -> int: ... @overload def chebyshev_distance( - layout: cartesian_layout | shifted_cartesian_layout, source: offset_coordinate, target: offset_coordinate + layout: cartesian_layout | shifted_cartesian_layout, + source: offset_coordinate | tuple[int, int] | tuple[int, int, int], + target: offset_coordinate | tuple[int, int] | tuple[int, int, int], ) -> int: ... @overload -def chebyshev_distance(layout: hexagonal_layout, source: cube_coordinate, target: cube_coordinate) -> int: ... +def chebyshev_distance( + layout: hexagonal_layout, + source: cube_coordinate | tuple[int, int] | tuple[int, int, int], + target: cube_coordinate | tuple[int, int] | tuple[int, int, int], +) -> int: ... class a_star_params: def __init__(self) -> None: ... @@ -871,15 +1318,15 @@ def a_star( | shifted_cartesian_obstruction_layout | shifted_cartesian_gate_layout | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, + source: offset_coordinate | tuple[int, int] | tuple[int, int, int], + target: offset_coordinate | tuple[int, int] | tuple[int, int, int], params: a_star_params | None = ..., ) -> list[offset_coordinate]: ... @overload def a_star( layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, + source: cube_coordinate | tuple[int, int] | tuple[int, int, int], + target: cube_coordinate | tuple[int, int] | tuple[int, int, int], params: a_star_params | None = ..., ) -> list[cube_coordinate]: ... @@ -896,15 +1343,15 @@ def enumerate_all_paths( | shifted_cartesian_obstruction_layout | shifted_cartesian_gate_layout | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, + source: offset_coordinate | tuple[int, int] | tuple[int, int, int], + target: offset_coordinate | tuple[int, int] | tuple[int, int, int], params: enumerate_all_paths_params | None = ..., ) -> list[list[offset_coordinate]]: ... @overload def enumerate_all_paths( layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, + source: cube_coordinate | tuple[int, int] | tuple[int, int, int], + target: cube_coordinate | tuple[int, int] | tuple[int, int, int], params: enumerate_all_paths_params | None = ..., ) -> list[list[cube_coordinate]]: ... @@ -921,16 +1368,16 @@ def yen_k_shortest_paths( | shifted_cartesian_obstruction_layout | shifted_cartesian_gate_layout | shifted_cartesian_layout, - source: offset_coordinate, - target: offset_coordinate, + source: offset_coordinate | tuple[int, int] | tuple[int, int, int], + target: offset_coordinate | tuple[int, int] | tuple[int, int, int], k: int, params: yen_k_shortest_paths_params | None = ..., ) -> list[list[offset_coordinate]]: ... @overload def yen_k_shortest_paths( layout: hexagonal_obstruction_layout | hexagonal_gate_layout | hexagonal_layout, - source: cube_coordinate, - target: cube_coordinate, + source: cube_coordinate | tuple[int, int] | tuple[int, int, int], + target: cube_coordinate | tuple[int, int] | tuple[int, int, int], k: int, params: yen_k_shortest_paths_params | None = ..., ) -> list[list[cube_coordinate]]: ... @@ -1171,7 +1618,7 @@ class design_sidb_gates_params: def design_sidb_gates( skeleton: sidb_100_lattice | sidb_111_lattice, - spec: [[int, int], int], + spec: list[dynamic_truth_table], params: design_sidb_gates_params = ..., stats: design_sidb_gates_stats | None = None, ) -> list[sidb_100_lattice | sidb_111_lattice]: ... @@ -1274,10 +1721,10 @@ class sample_writing_mode(Enum): OPERATIONAL_ONLY: ... class write_operational_domain_params: - def __init__(self) -> None: - self.operational_tag: str - self.non_operational_tag: str - self.writing_mode: sample_writing_mode + def __init__(self) -> None: ... + operational_tag: str + non_operational_tag: str + writing_mode: sample_writing_mode def write_operational_domain( opdom: operational_domain, filename: str, params: write_operational_domain_params | None = None @@ -1294,13 +1741,13 @@ class sidb_lattice_mode(Enum): HIDE_LATTICE: ... class write_sidb_layout_svg_params: - def __init__(self) -> None: - self.lattice_point_size: float - self.sidb_size: float - self.sidb_border_width: float - self.color_background: str - self.color_mode: color_mode - self.lattice_mode: sidb_lattice_mode + def __init__(self) -> None: ... + lattice_point_size: float + sidb_size: float + sidb_border_width: float + color_background: str + color_mode: color_mode + lattice_mode: sidb_lattice_mode class write_qca_layout_svg_params: def __init__(self) -> None: ... @@ -1352,7 +1799,7 @@ class bdl_input_iterator_params: input_bdl_config: input_bdl_configuration # Class for BDL input iterator -class bdl_input_iterator: +class bdl_input_iterator_100: def __init__(self, lyt: object, params: bdl_input_iterator_params) -> None: ... def __next__(self) -> object: ... def __eq__(self, n: int) -> bool: ... @@ -1361,32 +1808,50 @@ class bdl_input_iterator: def __le__(self, n: int) -> bool: ... def __gt__(self, n: int) -> bool: ... def __ge__(self, n: int) -> bool: ... - def __add__(self, n: int) -> bdl_input_iterator: ... + def __add__(self, n: int) -> bdl_input_iterator_100: ... def __iadd__(self, n: int) -> Self: ... - def __sub__(self, n: int) -> bdl_input_iterator: ... + def __sub__(self, n: int) -> bdl_input_iterator_100: ... def __isub__(self, n: int) -> Self: ... - def __getitem__(self, n: int) -> bdl_input_iterator: ... + def __getitem__(self, n: int) -> bdl_input_iterator_100: ... def num_input_pairs(self) -> int: ... - def get_layout(self) -> object: ... + def get_layout(self) -> sidb_layout: ... -# Function to register BDL input iterator for different lattice types -def bdl_input_iterator_100(lyt: object, params: bdl_input_iterator_params) -> bdl_input_iterator: ... -def bdl_input_iterator_111(lyt: object, params: bdl_input_iterator_params) -> bdl_input_iterator: ... +class bdl_input_iterator_111: + def __init__(self, lyt: object, params: bdl_input_iterator_params) -> None: ... + def __next__(self) -> object: ... + def __eq__(self, n: int) -> bool: ... + def __ne__(self, n: int) -> bool: ... + def __lt__(self, n: int) -> bool: ... + def __le__(self, n: int) -> bool: ... + def __gt__(self, n: int) -> bool: ... + def __ge__(self, n: int) -> bool: ... + def __add__(self, n: int) -> bdl_input_iterator_111: ... + def __iadd__(self, n: int) -> Self: ... + def __sub__(self, n: int) -> bdl_input_iterator_111: ... + def __isub__(self, n: int) -> Self: ... + def __getitem__(self, n: int) -> bdl_input_iterator_111: ... + def num_input_pairs(self) -> int: ... + def get_layout(self) -> sidb_layout: ... class bdl_pair: - def __init__(self, t: sidb_technology.cell_type, u: offset_coordinate, l: offset_coordinate) -> None: - self.type: sidb_technology.cell_type - self.upper: offset_coordinate - self.lower: offset_coordinate + def __init__( + self, + t: sidb_technology.cell_type, + u: offset_coordinate | tuple[int, int] | tuple[int, int, int], + l: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> None: ... + type: sidb_technology.cell_type + upper: offset_coordinate | tuple[int, int] | tuple[int, int, int] + lower: offset_coordinate | tuple[int, int] | tuple[int, int, int] class detect_bdl_pairs_params: - def __init__(self) -> None: - self.minimum_distance: float - self.maximum_distance: float + def __init__(self) -> None: ... + minimum_distance: float + maximum_distance: float def detect_bdl_pairs( lyt: sidb_100_lattice | sidb_111_lattice, - type: sidb_technology.cell_type | None = None, + cell_type: sidb_technology.cell_type | None = None, params: detect_bdl_pairs_params = ..., ) -> list[bdl_pair]: ... @@ -1413,9 +1878,9 @@ class sidb_defect: electric_charge: int = 0, relative_permittivity: float = 0.0, screening_distance: float = 0.0, - ) -> None: - def __eq__(self, rhs: sidb_defect) -> bool: ... - def __ne__(self, rhs: sidb_defect) -> bool: ... + ) -> None: ... + def __eq__(self, rhs: sidb_defect) -> bool: ... + def __ne__(self, rhs: sidb_defect) -> bool: ... type: sidb_defect_type charge: int @@ -1473,7 +1938,24 @@ class sidb_111_lattice_orientation(Enum): LAT_B: float LAT_C: tuple[float, float] +class sidb_simulation_parameters: + def __init__( + self, + base_number: int = 3, + mu_minus: float = -0.32, + relative_permittivity: float = 5.6, + screening_distance: float = 5.0, + ) -> None: ... + def k(self) -> float: ... + def mu_plus(self) -> float: ... + + epsilon_r: float + lambda_tf: float + mu_minus: float + base: int + class charge_distribution_surface_100(sidb_100_lattice): + @overload def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( @@ -1489,32 +1971,53 @@ class charge_distribution_surface_100(sidb_100_lattice): def assign_physical_parameters(self, params: sidb_simulation_parameters) -> None: ... def get_phys_params(self) -> sidb_simulation_parameters: ... def charge_exists(self, cs: sidb_charge_state) -> bool: ... - def cell_to_index(self, c: offset_coordinate) -> int: ... + def cell_to_index(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, + c: offset_coordinate | tuple[int, int] | tuple[int, int, int], + cs: sidb_charge_state, + index_mode: charge_index_mode = ..., ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... - def assign_dependent_cell(self, dependent_cell: offset_coordinate) -> None: ... + def assign_dependent_cell( + self, dependent_cell: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> None: ... def assign_base_number(self, base: int) -> None: ... def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... - def erase_defect(self, c: offset_coordinate) -> None: ... + def erase_defect(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... def assign_charge_state_by_cell_index( self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... - def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... + def get_charge_state(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... def get_all_sidb_charges(self) -> list[sidb_charge_state]: ... def negative_sidb_detection(self) -> list[int]: ... - def get_nm_distance_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_nm_distance_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... def get_nm_distance_by_indices(self, index1: int, index2: int) -> float: ... def calculate_chargeless_potential_between_sidbs_by_index(self, index1: int, index2: int) -> float: ... - def calculate_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... - def get_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def calculate_chargeless_potential_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... + def get_chargeless_potential_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... def get_chargeless_potential_by_indices(self, index1: int, index2: int) -> float: ... - def get_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_potential_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... def update_local_potential(self, consider_history: charge_distribution_history) -> None: ... - def get_local_potential(self, c: offset_coordinate) -> float: ... + def get_local_potential(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> float: ... def get_local_potential_by_index(self, index: int) -> float: ... def assign_system_energy_to_zero(self) -> None: ... def recompute_system_energy(self) -> None: ... @@ -1538,15 +2041,17 @@ class charge_distribution_surface_100(sidb_100_lattice): engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... - def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... + def assign_charge_index( + self, charge_index: int, cdc: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... - def three_state_cell_to_index(self, c: offset_coordinate) -> int: ... - def two_state_cell_to_index(self, c: offset_coordinate) -> int: ... + def three_state_cell_to_index(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... + def two_state_cell_to_index(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... def index_to_cell(self, index: int) -> offset_coordinate: ... def index_to_three_state_cell(self, index: int) -> offset_coordinate: ... def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... @@ -1580,7 +2085,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def get_max_charge_index_sub_layout(self) -> int: ... def assign_charge_index_by_two_gray_codes(self, gray_code: int, gray_code_old: int) -> None: ... def get_sidb_order(self) -> list[int]: ... - def add_sidb(self, cell: offset_coordinate, charge: int) -> None: ... + def add_sidb(self, cell: offset_coordinate | tuple[int, int] | tuple[int, int, int], charge: int) -> None: ... def cells(self) -> list[tuple[int, int, int]]: ... def pis(self) -> list[tuple[int, int, int]]: ... def pos(self) -> list[tuple[int, int, int]]: ... @@ -1588,6 +2093,7 @@ class charge_distribution_surface_100(sidb_100_lattice): def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... class charge_distribution_surface_111(sidb_111_lattice): + @overload def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( @@ -1603,32 +2109,53 @@ class charge_distribution_surface_111(sidb_111_lattice): def assign_physical_parameters(self, params: sidb_simulation_parameters) -> None: ... def get_phys_params(self) -> sidb_simulation_parameters: ... def charge_exists(self, cs: sidb_charge_state) -> bool: ... - def cell_to_index(self, c: offset_coordinate) -> int: ... + def cell_to_index(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, + c: offset_coordinate | tuple[int, int] | tuple[int, int, int], + cs: sidb_charge_state, + index_mode: charge_index_mode = ..., ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... - def assign_dependent_cell(self, dependent_cell: offset_coordinate) -> None: ... + def assign_dependent_cell( + self, dependent_cell: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> None: ... def assign_base_number(self, base: int) -> None: ... def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... - def erase_defect(self, c: offset_coordinate) -> None: ... + def erase_defect(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... def assign_charge_state_by_cell_index( self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... - def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... + def get_charge_state(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... def get_all_sidb_charges(self) -> list[sidb_charge_state]: ... def negative_sidb_detection(self) -> list[int]: ... - def get_nm_distance_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_nm_distance_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... def get_nm_distance_by_indices(self, index1: int, index2: int) -> float: ... def calculate_chargeless_potential_between_sidbs_by_index(self, index1: int, index2: int) -> float: ... - def calculate_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... - def get_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def calculate_chargeless_potential_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... + def get_chargeless_potential_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... def get_chargeless_potential_by_indices(self, index1: int, index2: int) -> float: ... - def get_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_potential_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... def update_local_potential(self, consider_history: charge_distribution_history) -> None: ... - def get_local_potential(self, c: offset_coordinate) -> float: ... + def get_local_potential(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> float: ... def get_local_potential_by_index(self, index: int) -> float: ... def assign_system_energy_to_zero(self) -> None: ... def recompute_system_energy(self) -> None: ... @@ -1652,15 +2179,17 @@ class charge_distribution_surface_111(sidb_111_lattice): engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... - def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... + def assign_charge_index( + self, charge_index: int, cdc: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... - def three_state_cell_to_index(self, c: offset_coordinate) -> int: ... - def two_state_cell_to_index(self, c: offset_coordinate) -> int: ... + def three_state_cell_to_index(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... + def two_state_cell_to_index(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... def index_to_cell(self, index: int) -> offset_coordinate: ... def index_to_three_state_cell(self, index: int) -> offset_coordinate: ... def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... @@ -1694,7 +2223,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def get_max_charge_index_sub_layout(self) -> int: ... def assign_charge_index_by_two_gray_codes(self, gray_code: int, gray_code_old: int) -> None: ... def get_sidb_order(self) -> list[int]: ... - def add_sidb(self, cell: offset_coordinate, charge: int) -> None: ... + def add_sidb(self, cell: offset_coordinate | tuple[int, int] | tuple[int, int, int], charge: int) -> None: ... def cells(self) -> list[tuple[int, int, int]]: ... def pis(self) -> list[tuple[int, int, int]]: ... def pos(self) -> list[tuple[int, int, int]]: ... @@ -1702,6 +2231,7 @@ class charge_distribution_surface_111(sidb_111_lattice): def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... class charge_distribution_surface(sidb_layout): + @overload def __init__(self, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ...) -> None: ... @overload def __init__( @@ -1717,32 +2247,53 @@ class charge_distribution_surface(sidb_layout): def assign_physical_parameters(self, params: sidb_simulation_parameters) -> None: ... def get_phys_params(self) -> sidb_simulation_parameters: ... def charge_exists(self, cs: sidb_charge_state) -> bool: ... - def cell_to_index(self, c: offset_coordinate) -> int: ... + def cell_to_index(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... def assign_charge_state( - self, c: offset_coordinate, cs: sidb_charge_state, index_mode: charge_index_mode = ... + self, + c: offset_coordinate | tuple[int, int] | tuple[int, int, int], + cs: sidb_charge_state, + index_mode: charge_index_mode = ..., ) -> None: ... def assign_charge_by_cell_index(self, i: int, cs: sidb_charge_state) -> None: ... def assign_all_charge_states(self, cs: sidb_charge_state) -> None: ... - def assign_dependent_cell(self, dependent_cell: offset_coordinate) -> None: ... + def assign_dependent_cell( + self, dependent_cell: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> None: ... def assign_base_number(self, base: int) -> None: ... def add_sidb_defect_to_potential_landscape(self, c: sidb_charge_state, defect: sidb_defect) -> None: ... - def erase_defect(self, c: offset_coordinate) -> None: ... + def erase_defect(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> None: ... def assign_charge_state_by_cell_index( self, index: int, cs: sidb_charge_state, index_mode: charge_index_mode = ... ) -> None: ... - def get_charge_state(self, c: offset_coordinate) -> sidb_charge_state: ... + def get_charge_state(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> sidb_charge_state: ... def get_charge_state_by_index(self, index: int) -> sidb_charge_state: ... def get_all_sidb_charges(self) -> list[sidb_charge_state]: ... def negative_sidb_detection(self) -> list[int]: ... - def get_nm_distance_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_nm_distance_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... def get_nm_distance_by_indices(self, index1: int, index2: int) -> float: ... def calculate_chargeless_potential_between_sidbs_by_index(self, index1: int, index2: int) -> float: ... - def calculate_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... - def get_chargeless_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def calculate_chargeless_potential_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... + def get_chargeless_potential_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... def get_chargeless_potential_by_indices(self, index1: int, index2: int) -> float: ... - def get_potential_between_sidbs(self, c1: offset_coordinate, c2: offset_coordinate) -> float: ... + def get_potential_between_sidbs( + self, + c1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + c2: offset_coordinate | tuple[int, int] | tuple[int, int, int], + ) -> float: ... def update_local_potential(self, consider_history: charge_distribution_history) -> None: ... - def get_local_potential(self, c: offset_coordinate) -> float: ... + def get_local_potential(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> float: ... def get_local_potential_by_index(self, index: int) -> float: ... def assign_system_energy_to_zero(self) -> None: ... def recompute_system_energy(self) -> None: ... @@ -1766,15 +2317,17 @@ class charge_distribution_surface(sidb_layout): engine: exact_sidb_simulation_engine = ..., ) -> None: ... def get_max_charge_index(self) -> int: ... - def assign_charge_index(self, charge_index: int, cdc: offset_coordinate) -> None: ... + def assign_charge_index( + self, charge_index: int, cdc: offset_coordinate | tuple[int, int] | tuple[int, int, int] + ) -> None: ... def adjacent_search(self, alpha: float, negative_indices: list[int]) -> None: ... def assign_global_external_potential( self, potential_value: float, dependent_cell: dependent_cell_mode = ... ) -> None: ... def is_three_state_simulation_required(self) -> bool: ... def get_positive_candidates(self) -> list[int]: ... - def three_state_cell_to_index(self, c: offset_coordinate) -> int: ... - def two_state_cell_to_index(self, c: offset_coordinate) -> int: ... + def three_state_cell_to_index(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... + def two_state_cell_to_index(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... def index_to_cell(self, index: int) -> offset_coordinate: ... def index_to_three_state_cell(self, index: int) -> offset_coordinate: ... def index_to_two_state_cell(self, index: int) -> offset_coordinate: ... @@ -1808,16 +2361,13 @@ class charge_distribution_surface(sidb_layout): def get_max_charge_index_sub_layout(self) -> int: ... def assign_charge_index_by_two_gray_codes(self, gray_code: int, gray_code_old: int) -> None: ... def get_sidb_order(self) -> list[int]: ... - def add_sidb(self, cell: offset_coordinate, charge: int) -> None: ... + def add_sidb(self, cell: offset_coordinate | tuple[int, int] | tuple[int, int, int], charge: int) -> None: ... def cells(self) -> list[tuple[int, int, int]]: ... def pis(self) -> list[tuple[int, int, int]]: ... def pos(self) -> list[tuple[int, int, int]]: ... def is_within_bounds(self, c: tuple[int, int, int]) -> bool: ... def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... -class sidb_simulation_parameters: - def __init__(self) -> None: ... - @overload def exhaustive_ground_state_simulation( lyt: sidb_100_lattice, params: sidb_simulation_parameters = ... @@ -1838,26 +2388,15 @@ class exact_sidb_simulation_engine(Enum): @overload def sidb_nm_position( - lyt: charge_distribution_surface | sidb_layout | sidb_100_lattice | sidb_111_lattice, c: sidb_technology.cell_type -) -> None: ... -def sidb_nm_distance_111(lyt: sidb_111_lattice, c: sidb_technology.cell_type) -> None: ... -def sidb_nm_distance_100(lyt: sidb_100_lattice, c: sidb_technology.cell_type) -> None: ... - -class sidb_simulation_parameters: - def __init__( - self, - base_number: int = 3, - mu_minus: float = -0.32, - relative_permittivity: float = 5.6, - screening_distance: float = 5.0, - ) -> None: ... - def k(self) -> float: ... - def mu_plus(self) -> float: ... - - epsilon_r: float - lambda_tf: float - mu_minus: float - base: int + lyt: charge_distribution_surface | sidb_layout | sidb_100_lattice | sidb_111_lattice, + c: offset_coordinate | tuple[int, int] | tuple[int, int, int], +) -> tuple[float, float]: ... +def sidb_nm_distance_111( + lyt: sidb_111_lattice, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] +) -> tuple[float, float]: ... +def sidb_nm_distance_100( + lyt: sidb_100_lattice, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] +) -> tuple[float, float]: ... class transition_type(Enum): NEUTRAL_TO_NEGATIVE: ... @@ -1985,11 +2524,11 @@ def kink_induced_non_operational_input_patterns( # QuickExact class quickexact_params: - def __init__(self) -> None: - self.simulation_parameters: sidb_simulation_parameters - self.base_number_detection: automatic_base_number_detection - self.local_external_potential: float - self.global_potential: float + def __init__(self) -> None: ... + simulation_parameters: sidb_simulation_parameters + base_number_detection: automatic_base_number_detection + local_external_potential: float + global_potential: float class automatic_base_number_detection(Enum): ON = ... @@ -1999,11 +2538,11 @@ def quickexact(lyt: sidb_100_lattice | sidb_111_lattice, params: quickexact_para # QuickSim class quicksim_params: - def __init__(self) -> None: - self.simulation_parameters: sidb_simulation_parameters - self.iteration_steps: int - self.alpha: float - self.number_threads: int + def __init__(self) -> None: ... + simulation_parameters: sidb_simulation_parameters + iteration_steps: int + alpha: float + number_threads: int def quicksim(lyt: sidb_100_lattice, params: quicksim_params) -> None: ... @@ -2049,7 +2588,11 @@ class sweep_parameter(Enum): class operational_domain_value_range: def __init__( - self, dimension: sweep_parameter, min: float | None = None, max: float | None = None, step: float | None = None + self, + dimension: sweep_parameter, + minimum: float | None = None, + maximum: float | None = None, + step: float | None = None, ) -> None: ... dimension: sweep_parameter @@ -2075,11 +2618,10 @@ class operational_domain_stats: class operational_domain: def __init__(self) -> None: ... - dimensions: list[operational_domain_value_range] operational_values: dict[parameter_point, str] + def get_value(self, point: parameter_point) -> str: ... -def get_value(self, point: parameter_point) -> str: ... def operational_domain_grid_search( lyt: sidb_100_lattice | sidb_111_lattice, spec: dict, @@ -2107,16 +2649,39 @@ def operational_domain_contour_tracing( params: operational_domain_params | None = None, stats: operational_domain_stats | None = None, ) -> operational_domain | None: ... +@overload +def calculate_energy_and_state_type_with_kinks_accepted( + energy_distribution: dict[float, int], + valid_charge_distributions: list[sidb_100_lattice], + output_bdl_pairs: list[bdl_wire_100], + spec: list[dynamic_truth_table], + input_index: int, +) -> None: ... +@overload def calculate_energy_and_state_type_with_kinks_accepted( - sidb_energy_distribution: ..., valid_charge_distributions: ..., output_bdl_pairs: ..., spec: ..., input_index: ... + energy_distribution: dict[float, int], + valid_charge_distributions: list[sidb_111_lattice], + output_bdl_pairs: list[bdl_wire_111], + spec: list[dynamic_truth_table], + input_index: int, ) -> None: ... +@overload +def calculate_energy_and_state_type_with_kinks_rejected( + energy_distribution: dict[float, int], + valid_charge_distributions: list[sidb_100_lattice], + spec: list[dynamic_truth_table], + input_index: int, + input_bdl_wires: list[bdl_wire_100], + output_bdl_wires: list[bdl_wire_100], +) -> None: ... +@overload def calculate_energy_and_state_type_with_kinks_rejected( - energy_distribution: ..., - valid_charge_distributions: ..., - spec: ..., - input_index: ..., - input_bdl_wires: ..., - output_bdl_wires: ..., + energy_distribution: dict[float, int], + valid_charge_distributions: list[sidb_111_lattice], + spec: list[dynamic_truth_table], + input_index: int, + input_bdl_wires: list[bdl_wire_111], + output_bdl_wires: list[bdl_wire_111], ) -> None: ... def can_positive_charges_occur( lyt: sidb_100_lattice | sidb_111_lattice, @@ -2134,13 +2699,7 @@ def check_simulation_results_for_equivalence( ) -> bool: ... class sidb_simulation_result_100: - def __init__(self) -> None: - self.algorithm_name: str - self.simulation_runtime: float - self.charge_distributions: list[charge_distribution_surface_100] - self.simulation_parameters: sidb_simulation_parameters - self.additional_simulation_parameters: dict[str, Any] - + def __init__(self) -> None: ... algorithm_name: str simulation_runtime: float charge_distributions: list[charge_distribution_surface_100] @@ -2148,13 +2707,7 @@ class sidb_simulation_result_100: additional_simulation_parameters: dict[str, Any] class sidb_simulation_result_111: - def __init__(self) -> None: - self.algorithm_name: str - self.simulation_runtime: float - self.charge_distributions: list[charge_distribution_surface_111] - self.simulation_parameters: sidb_simulation_parameters - self.additional_simulation_parameters: dict[str, Any] - + def __init__(self) -> None: ... algorithm_name: str simulation_runtime: float charge_distributions: list[charge_distribution_surface_111] @@ -2162,18 +2715,18 @@ class sidb_simulation_result_111: additional_simulation_parameters: dict[str, Any] class time_to_solution_params: - def __init__(self) -> None: - self.engine: str - self.repetitions: int - self.confidence_level: float + def __init__(self) -> None: ... + engine: str + repetitions: int + confidence_level: float class time_to_solution_stats: - def __init__(self) -> None: - self.time_to_solution: float - self.acc: float - self.mean_single_runtime: float - self.single_runtime_exact: float - self.algorithm: str + def __init__(self) -> None: ... + time_to_solution: float + acc: float + mean_single_runtime: float + single_runtime_exact: float + algorithm: str def report(self, stream: str | None = None) -> None: ... @@ -2182,13 +2735,21 @@ def time_to_solution( quickim_params: quicksim_params, tts_params: time_to_solution_params = ..., ps: time_to_solution_stats | None = None, -) -> time_to_solution_stats: ... +) -> None: ... +@overload def time_to_solution_for_given_simulation_results( - results_exact: sidb_simulation_result_100 | sidb_simulation_result_111, - results_heuristic: list[sidb_simulation_result_100 | sidb_simulation_result_111], + results_exact: sidb_simulation_result_100, + results_heuristic: list[sidb_simulation_result_100], confidence_level: float = 0.997, ps: time_to_solution_stats | None = None, -) -> time_to_solution_stats: ... +) -> None: ... +@overload +def time_to_solution_for_given_simulation_results( + results_exact: sidb_simulation_result_111, + results_heuristic: list[sidb_simulation_result_111], + confidence_level: float = 0.997, + ps: time_to_solution_stats | None = None, +) -> None: ... @overload def is_ground_state( heuristic_results: sidb_simulation_result_100, @@ -2209,19 +2770,19 @@ class dimer_displacement_policy(Enum): ALLOW_OTHER_DIMER = 1 class displacement_robustness_domain_params: - def __init__(self) -> None: - self.analysis_mode: displacement_analysis_mode - self.percentage_of_analyzed_displaced_layouts: float - self.displacement_variations: int - self.operational_params: is_operational_params - self.fixed_sidbs: list[siqad_coordinate | offset_coordinate] - self.dimer_policy: dimer_displacement_policy + def __init__(self) -> None: ... + analysis_mode: displacement_analysis_mode + percentage_of_analyzed_displaced_layouts: float + displacement_variations: int + operational_params: is_operational_params + fixed_sidbs: list[siqad_coordinate | offset_coordinate] + dimer_policy: dimer_displacement_policy class displacement_robustness_domain_stats: - def __init__(self) -> None: - self.time_total: float - self.num_operational_sidb_displacements: int - self.num_non_operational_sidb_displacements: int + def __init__(self) -> None: ... + time_total: float + num_operational_sidb_displacements: int + num_non_operational_sidb_displacements: int class displacement_robustness_domain_100: def __init__(self) -> None: ... @@ -2231,13 +2792,13 @@ class displacement_robustness_domain_111: def determine_displacement_robustness_domain_100( layout: sidb_100_lattice, - spec: ..., + spec: list[dynamic_truth_table], params: displacement_robustness_domain_params, stats: displacement_robustness_domain_stats | None = None, ) -> None: ... def determine_displacement_robustness_domain_111( layout: sidb_111_lattice, - spec: ..., + spec: list[dynamic_truth_table], params: displacement_robustness_domain_params, stats: displacement_robustness_domain_stats | None = None, ) -> None: ... @@ -2246,10 +2807,11 @@ def occupation_probability_non_gate_based(energy_distribution: list[float], temp class compute_operational_ratio_params: def __init__(self) -> None: ... + op_domain_params: operational_domain_params def compute_operational_ratio( lyt: sidb_100_lattice | sidb_111_lattice, - spec: ..., + spec: list[dynamic_truth_table], pp: parameter_point, params: compute_operational_ratio_params = ..., ) -> float: ... @@ -2309,9 +2871,15 @@ def create_crossing_wire_tt() -> Callable[[int, int], int]: ... def create_fan_out_tt() -> Callable[[int], int]: ... def create_half_adder_tt() -> Callable[[int, int], int]: ... @overload -def random_coordinate(coordinate1: offset_coordinate, coordinate2: offset_coordinate) -> offset_coordinate: ... +def random_coordinate( + coordinate1: offset_coordinate | tuple[int, int] | tuple[int, int, int], + coordinate2: offset_coordinate | tuple[int, int] | tuple[int, int, int], +) -> offset_coordinate: ... @overload -def random_coordinate(coordinate1: cube_coordinate, coordinate2: cube_coordinate) -> cube_coordinate: ... +def random_coordinate( + coordinate1: cube_coordinate | tuple[int, int] | tuple[int, int, int], + coordinate2: cube_coordinate | tuple[int, int] | tuple[int, int, int], +) -> cube_coordinate: ... @overload def random_coordinate(coordinate1: siqad_coordinate, coordinate2: siqad_coordinate) -> siqad_coordinate: ... def normalize_layout_coordinates( @@ -2319,4 +2887,4 @@ def normalize_layout_coordinates( ) -> None: ... def convert_potential_to_distance( potential: float, params: sidb_simulation_parameters = ..., precision: float = 2 -) -> Any: ... +) -> float: ... From e670dc3d6b4ef82e003755a729a09d1dd438a652 Mon Sep 17 00:00:00 2001 From: Marcel Walter Date: Thu, 12 Dec 2024 10:48:42 +0100 Subject: [PATCH 42/42] :rotating_light: Fixed a bunch more warnings and errors (still a long way to go) --- bindings/mnt/pyfiction/__init__.py | 52 +--- .../algorithms/iter/bdl_input_iterator.hpp | 23 +- .../charge_distribution_surface.hpp | 25 -- .../pyfiction/technology/sidb_lattice.hpp | 8 +- .../pyfiction/technology/sidb_nm_distance.hpp | 10 +- bindings/mnt/pyfiction/pyfiction.pyi | 240 +++++++++--------- .../test_post_layout_optimization.py | 4 +- .../physical_design/test_wiring_reduction.py | 4 +- .../test/technology/test_sidb_nm_distance.py | 22 +- include/fiction/technology/sidb_lattice.hpp | 2 +- 10 files changed, 175 insertions(+), 215 deletions(-) diff --git a/bindings/mnt/pyfiction/__init__.py b/bindings/mnt/pyfiction/__init__.py index 0a5fb1848..bbb094a4a 100644 --- a/bindings/mnt/pyfiction/__init__.py +++ b/bindings/mnt/pyfiction/__init__.py @@ -23,7 +23,6 @@ __version__, a_star, a_star_distance, - ## path_finding a_star_params, all_standard_2_input_functions, all_standard_3_input_functions, @@ -31,13 +30,10 @@ and_or_not, and_or_not_maj, apply_bestagon_library, - ## physical_design apply_qca_one_library, apply_topolinano_library, area, - assess_physical_population_stability_100, - assess_physical_population_stability_111, - # Technology + assess_physical_population_stability, assess_physical_population_stability_params, automatic_base_number_detection, bdl_input_iterator_100, @@ -51,7 +47,6 @@ calculate_energy_and_state_type_with_kinks_rejected, can_positive_charges_occur, cartesian_gate_layout, - # Layouts cartesian_layout, cartesian_obstruction_layout, charge_configuration_to_string, @@ -99,7 +94,6 @@ create_xor3_tt, create_xor_and_tt, create_xor_tt, - ## properties critical_path_length_and_throughput, critical_temperature_gate_based, critical_temperature_non_gate_based, @@ -145,9 +139,7 @@ extract_routing_objectives, fanout_substitution, fanout_substitution_params, - # Inout fgl_parsing_error, - ## verfication gate_level_drv_params, gate_level_drvs, get_name, @@ -162,11 +154,10 @@ hexagonal_layout, hexagonal_obstruction_layout, hexagonalization, + hexagonalization_stats, high_degree_fanin_exception, inml_layout, inml_technology, - # Algorithms - ## iter input_bdl_configuration, is_balanced, is_charged_defect_type, @@ -188,7 +179,6 @@ network_balancing, network_balancing_params, normalize_layout_coordinates, - # Utils num_adjacent_coordinates, occupation_probability_gate_based, occupation_probability_non_gate_based, @@ -244,8 +234,7 @@ sidb_defect_type, sidb_lattice_mode, sidb_layout, - sidb_nm_distance_100, - sidb_nm_distance_111, + sidb_nm_distance, sidb_nm_position, sidb_simulation_engine, sidb_simulation_parameters, @@ -253,19 +242,16 @@ sidb_simulation_result_111, sidb_technology, sign_to_charge_state, - ### logic simulate, siqad_coordinate, sqd_parsing_error, squared_euclidean_distance, - ## network_transformation substitution_strategy, sweep_parameter, technology_constraints, technology_mapping, technology_mapping_params, technology_mapping_stats, - # Networks technology_network, time_to_solution, time_to_solution_for_given_simulation_results, @@ -274,8 +260,6 @@ to_cube_coord, to_offset_coord, to_siqad_coord, - ## simulation - ### sidb transition_type, twoddwave_distance, undefined_cell_label_exception, @@ -314,7 +298,6 @@ "__version__", "a_star", "a_star_distance", - ## path_finding "a_star_params", "all_standard_2_input_functions", "all_standard_3_input_functions", @@ -322,13 +305,11 @@ "and_or_not", "and_or_not_maj", "apply_bestagon_library", - ## physical_design "apply_qca_one_library", "apply_topolinano_library", - # Technology "area", - "assess_physical_population_stability_100", - "assess_physical_population_stability_111", + "area", + "assess_physical_population_stability", "assess_physical_population_stability_params", "automatic_base_number_detection", "bdl_input_iterator_100", @@ -342,7 +323,6 @@ "calculate_energy_and_state_type_with_kinks_rejected", "can_positive_charges_occur", "cartesian_gate_layout", - # Layouts "cartesian_layout", "cartesian_obstruction_layout", "charge_configuration_to_string", @@ -390,7 +370,6 @@ "create_xor3_tt", "create_xor_and_tt", "create_xor_tt", - ## properties "critical_path_length_and_throughput", "critical_temperature_gate_based", "critical_temperature_non_gate_based", @@ -436,9 +415,7 @@ "extract_routing_objectives", "fanout_substitution", "fanout_substitution_params", - # Inout "fgl_parsing_error", - ## verfication "gate_level_drv_params", "gate_level_drvs", "get_name", @@ -453,17 +430,15 @@ "hexagonal_layout", "hexagonal_obstruction_layout", "hexagonalization", + "hexagonalization_stats", "high_degree_fanin_exception", "inml_layout", "inml_technology", - # Algorithms - ## iter "input_bdl_configuration", "is_balanced", "is_charged_defect_type", "is_crossable_wire", "is_fanout_substituted", - set_name, "is_ground_state", "is_kink_induced_non_operational", "is_negatively_charged_defect", @@ -480,7 +455,6 @@ "network_balancing", "network_balancing_params", "normalize_layout_coordinates", - # Utils "num_adjacent_coordinates", "occupation_probability_gate_based", "occupation_probability_non_gate_based", @@ -525,6 +499,7 @@ "route_path", # "write_location_and_ground_state", "sample_writing_mode", + "set_name", "shifted_cartesian_gate_layout", "shifted_cartesian_layout", "shifted_cartesian_obstruction_layout", @@ -533,9 +508,9 @@ "sidb_charge_state", "sidb_defect", "sidb_defect_type", + "sidb_lattice_mode", "sidb_layout", - "sidb_nm_distance_100", - "sidb_nm_distance_111", + "sidb_nm_distance", "sidb_nm_position", "sidb_simulation_engine", "sidb_simulation_parameters", @@ -543,21 +518,16 @@ "sidb_simulation_result_111", "sidb_technology", "sign_to_charge_state", - ### logic "simulate", - "area", "siqad_coordinate", - "volume", "sqd_parsing_error", "squared_euclidean_distance", - ## network_transformation "substitution_strategy", "sweep_parameter", "technology_constraints", "technology_mapping", "technology_mapping_params", "technology_mapping_stats", - # Networks "technology_network", "time_to_solution", "time_to_solution_for_given_simulation_results", @@ -566,13 +536,12 @@ "to_cube_coord", "to_offset_coord", "to_siqad_coord", - ## simulation - ### sidb "transition_type", "twoddwave_distance", "undefined_cell_label_exception", "unrecognized_cell_definition_exception", "unsupported_character_exception", + "volume", "wiring_reduction", "wiring_reduction_params", "wiring_reduction_stats", @@ -596,5 +565,4 @@ "write_sqd_sim_result", "yen_k_shortest_paths", "yen_k_shortest_paths_params", - "sidb_lattice_mode", ] diff --git a/bindings/mnt/pyfiction/include/pyfiction/algorithms/iter/bdl_input_iterator.hpp b/bindings/mnt/pyfiction/include/pyfiction/algorithms/iter/bdl_input_iterator.hpp index f6793eb22..2f5888d69 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/algorithms/iter/bdl_input_iterator.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/algorithms/iter/bdl_input_iterator.hpp @@ -48,10 +48,29 @@ void bdl_input_iterator(pybind11::module& m, const std::string& lattice) }, DOC(fiction_bdl_input_iterator_operator_mul)) .def( - "__eq__", [](const fiction::bdl_input_iterator& self, const uint64_t n) -> bool { return self == n; }, + "__eq__", + [](const fiction::bdl_input_iterator& self, const py::object& other) -> bool + { + if (!py::isinstance(other)) + { + return false; + } + + return self == other.cast(); + }, + py::arg("m"), DOC(fiction_bdl_input_iterator_operator_eq)) .def( - "__ne__", [](const fiction::bdl_input_iterator& self, const uint64_t n) -> bool { return self != n; }, + "__ne__", + [](const fiction::bdl_input_iterator& self, const py::object& other) -> bool + { + if (!py::isinstance(other)) + { + return false; + } + + return self != other.cast(); + }, py::arg("m"), DOC(fiction_bdl_input_iterator_operator_ne)) .def( "__lt__", [](const fiction::bdl_input_iterator& self, const uint64_t n) -> bool { return self < n; }, diff --git a/bindings/mnt/pyfiction/include/pyfiction/technology/charge_distribution_surface.hpp b/bindings/mnt/pyfiction/include/pyfiction/technology/charge_distribution_surface.hpp index 4ccf9c8c5..21c9f2cfb 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/technology/charge_distribution_surface.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/technology/charge_distribution_surface.hpp @@ -212,31 +212,6 @@ void charge_distribution_surface_layout(pybind11::module& m, const std::string& .def("get_sidb_order", &py_cds::get_sidb_order) .def("add_sidb", &py_cds::add_sidb, py::arg("cell"), py::arg("charge")) - .def("cells", - [](const py_cds& lyt) - { - std::vector> cells{}; - cells.reserve(lyt.num_cells()); - lyt.foreach_cell([&cells](const auto& c) { cells.push_back(c); }); - return cells; - }) - .def("pis", - [](const py_cds& lyt) - { - std::vector> pis{}; - pis.reserve(lyt.num_pis()); - lyt.foreach_pi([&pis](const auto& c) { pis.push_back(c); }); - return pis; - }) - .def("pos", - [](const py_cds& lyt) - { - std::vector> pos{}; - pos.reserve(lyt.num_pos()); - lyt.foreach_po([&pos](const auto& c) { pos.push_back(c); }); - return pos; - }) - .def( "is_within_bounds", [](const py_cds& lyt, const fiction::coordinate& c) { return lyt.is_within_bounds(c); }, py::arg("c"), DOC(fiction_cartesian_layout_is_within_bounds)) diff --git a/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_lattice.hpp b/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_lattice.hpp index 6f96e1efe..044b211e0 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_lattice.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_lattice.hpp @@ -8,7 +8,6 @@ #include "pyfiction/documentation.hpp" #include "pyfiction/types.hpp" -#include #include #include #include @@ -18,9 +17,7 @@ #include #include -#include #include -#include namespace pyfiction { @@ -45,8 +42,9 @@ void sidb_lattice_cell_level_layout(pybind11::module& m) py::class_(m, fmt::format("sidb_{}_lattice", orientation).c_str(), DOC(fiction_cell_level_layout), py::module_local()) .def(py::init<>()) - .def(py::init&, const std::string&>(), py::arg("dimension"), - py::arg("name") = "", DOC(fiction_sidb_lattice)) + .def(py::init&, const std::string&>(), + py::arg("dimension") = fiction::aspect_ratio{}, py::arg("name") = "", + DOC(fiction_sidb_lattice)) ; } diff --git a/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_nm_distance.hpp b/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_nm_distance.hpp index 0d7607832..28925a99f 100644 --- a/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_nm_distance.hpp +++ b/bindings/mnt/pyfiction/include/pyfiction/technology/sidb_nm_distance.hpp @@ -21,20 +21,20 @@ namespace detail { template -void nanometer_distance(pybind11::module& m, const std::string& lattice = "") +void nanometer_distance(pybind11::module& m) { namespace py = pybind11; - m.def(fmt::format("sidb_nm_distance{}", lattice).c_str(), &fiction::sidb_nm_distance, py::arg("lyt"), - py::arg("source"), py::arg("target"), DOC(fiction_sidb_nm_distance)); + m.def(fmt::format("sidb_nm_distance").c_str(), &fiction::sidb_nm_distance, py::arg("lyt"), py::arg("source"), + py::arg("target"), DOC(fiction_sidb_nm_distance)); } } // namespace detail inline void sidb_nm_distance(pybind11::module& m) { - detail::nanometer_distance(m, "_100"); - detail::nanometer_distance(m, "_111"); + detail::nanometer_distance(m); + detail::nanometer_distance(m); } } // namespace pyfiction diff --git a/bindings/mnt/pyfiction/pyfiction.pyi b/bindings/mnt/pyfiction/pyfiction.pyi index 6ee92f43c..af48bb1bd 100644 --- a/bindings/mnt/pyfiction/pyfiction.pyi +++ b/bindings/mnt/pyfiction/pyfiction.pyi @@ -1,5 +1,5 @@ from enum import Enum -from typing import Any, Callable, overload +from typing import Any, Callable, Iterable, overload from typing_extensions import Self @@ -11,7 +11,7 @@ class offset_coordinate: @overload def __init__(self, int_repr: int) -> None: ... @overload - def __init__(self, x: int, y: int, z: int) -> None: ... + def __init__(self, x: int, y: int, z: int = 0) -> None: ... @overload def __init__(self, c: offset_coordinate) -> None: ... @overload @@ -297,7 +297,7 @@ class shifted_cartesian_layout: def is_ground_layer(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def is_crossing_layer(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... def is_within_bounds(self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... - def offset_coordinates(self) -> list[offset_coordinate]: ... + def coordinates(self) -> list[offset_coordinate]: ... def ground_coordinates(self) -> list[offset_coordinate]: ... def adjacent_coordinates( self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] @@ -531,11 +531,11 @@ class cartesian_gate_layout(clocked_cartesian_layout): layout_name: str = "", ) -> None: ... def create_pi( - self, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + self, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = ... + ) -> int: ... def create_po( - self, s: int, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + self, s: int, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = ... + ) -> int: ... def is_pi(self, n: int) -> bool: ... def is_po(self, n: int) -> bool: ... def is_pi_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... @@ -560,31 +560,31 @@ class cartesian_gate_layout(clocked_cartesian_layout): def get_name(self, s: int) -> str: ... def create_buf( self, a: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_not( self, a: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_and( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_nand( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_or( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_nor( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_xor( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_xnor( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_maj( self, a: int, b: int, c: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def num_pis(self) -> int: ... def num_pos(self) -> int: ... def num_gates(self) -> int: ... @@ -593,6 +593,7 @@ class cartesian_gate_layout(clocked_cartesian_layout): def is_empty(self) -> bool: ... def fanin_size(self, n: int) -> int: ... def fanout_size(self, n: int) -> int: ... + def get_node(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> int: ... def get_tile(self, n: int) -> int: ... def make_signal(self, n: int) -> int: ... def move_node( @@ -663,11 +664,11 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): layout_name: str = "", ) -> None: ... def create_pi( - self, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + self, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = ... + ) -> int: ... def create_po( - self, s: int, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + self, s: int, name: str = "", t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = ... + ) -> int: ... def is_pi(self, n: int) -> bool: ... def is_po(self, n: int) -> bool: ... def is_pi_coordinate(self, t: offset_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... @@ -691,31 +692,31 @@ class shifted_cartesian_gate_layout(clocked_shifted_cartesian_layout): def get_name(self, s: int) -> str: ... def create_buf( self, a: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_not( self, a: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_and( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_nand( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_or( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_nor( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_xor( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_xnor( self, a: int, b: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_maj( self, a: int, b: int, c: int, t: offset_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def num_pis(self) -> int: ... def num_pos(self) -> int: ... def num_gates(self) -> int: ... @@ -795,11 +796,11 @@ class hexagonal_gate_layout(clocked_hexagonal_layout): layout_name: str = "", ) -> None: ... def create_pi( - self, name: str = "", t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + self, name: str = "", t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = ... + ) -> int: ... def create_po( - self, s: int, name: str = "", t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + self, s: int, name: str = "", t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = ... + ) -> int: ... def is_pi(self, n: int) -> bool: ... def is_po(self, n: int) -> bool: ... def is_pi_coordinate(self, t: cube_coordinate | tuple[int, int] | tuple[int, int, int]) -> bool: ... @@ -821,29 +822,29 @@ class hexagonal_gate_layout(clocked_hexagonal_layout): def set_output_name(self, index: int, name: str) -> None: ... def get_output_name(self, index: int) -> str: ... def get_name(self, s: int) -> str: ... - def create_buf(self, a: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None) -> None: ... - def create_not(self, a: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None) -> None: ... + def create_buf(self, a: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None) -> int: ... + def create_not(self, a: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None) -> int: ... def create_and( self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_nand( self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_or( self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_nor( self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_xor( self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_xnor( self, a: int, b: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def create_maj( self, a: int, b: int, c: int, t: cube_coordinate | tuple[int, int] | tuple[int, int, int] | None = None - ) -> None: ... + ) -> int: ... def num_pis(self) -> int: ... def num_pos(self) -> int: ... def num_gates(self) -> int: ... @@ -1121,12 +1122,12 @@ class sidb_layout(clocked_cartesian_layout): class sidb_100_lattice(sidb_layout): def __init__( - self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], name: str = "" + self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int] = ..., name: str = "" ) -> None: ... class sidb_111_lattice(sidb_layout): def __init__( - self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int], name: str = "" + self, dimension: offset_coordinate | tuple[int, int] | tuple[int, int, int] = ..., name: str = "" ) -> None: ... # Networks @@ -1181,8 +1182,8 @@ class dynamic_truth_table: ## network transformation class substitution_strategy: - BREADTH: int - DEPTH: int + BREADTH: ... + DEPTH: ... class fanout_substitution_params: def __init__(self) -> None: ... @@ -1611,9 +1612,9 @@ class design_sidb_gates_mode(Enum): class design_sidb_gates_params: def __init__(self) -> None: ... - operational_params: operational_domain_params + operational_params: is_operational_params design_mode: design_sidb_gates_mode - canvas: [offset_coordinate, offset_coordinate] + canvas: tuple[offset_coordinate, offset_coordinate] number_of_sidbs: int def design_sidb_gates( @@ -1799,37 +1800,37 @@ class bdl_input_iterator_params: input_bdl_config: input_bdl_configuration # Class for BDL input iterator -class bdl_input_iterator_100: - def __init__(self, lyt: object, params: bdl_input_iterator_params) -> None: ... +class bdl_input_iterator_100(Iterable): + def __init__(self, lyt: sidb_100_lattice, params: bdl_input_iterator_params = ...) -> None: ... def __next__(self) -> object: ... - def __eq__(self, n: int) -> bool: ... - def __ne__(self, n: int) -> bool: ... - def __lt__(self, n: int) -> bool: ... - def __le__(self, n: int) -> bool: ... - def __gt__(self, n: int) -> bool: ... - def __ge__(self, n: int) -> bool: ... - def __add__(self, n: int) -> bdl_input_iterator_100: ... - def __iadd__(self, n: int) -> Self: ... - def __sub__(self, n: int) -> bdl_input_iterator_100: ... - def __isub__(self, n: int) -> Self: ... - def __getitem__(self, n: int) -> bdl_input_iterator_100: ... + def __eq__(self, m: object) -> bool: ... + def __ne__(self, m: object) -> bool: ... + def __lt__(self, m: int) -> bool: ... + def __le__(self, m: int) -> bool: ... + def __gt__(self, m: int) -> bool: ... + def __ge__(self, m: int) -> bool: ... + def __add__(self, m: int) -> bdl_input_iterator_100: ... + def __iadd__(self, m: int) -> Self: ... + def __sub__(self, m: int) -> bdl_input_iterator_100: ... + def __isub__(self, m: int) -> Self: ... + def __getitem__(self, m: int) -> bdl_input_iterator_100: ... def num_input_pairs(self) -> int: ... def get_layout(self) -> sidb_layout: ... -class bdl_input_iterator_111: - def __init__(self, lyt: object, params: bdl_input_iterator_params) -> None: ... +class bdl_input_iterator_111(Iterable): + def __init__(self, lyt: sidb_111_lattice, params: bdl_input_iterator_params) -> None: ... def __next__(self) -> object: ... - def __eq__(self, n: int) -> bool: ... - def __ne__(self, n: int) -> bool: ... - def __lt__(self, n: int) -> bool: ... - def __le__(self, n: int) -> bool: ... - def __gt__(self, n: int) -> bool: ... - def __ge__(self, n: int) -> bool: ... - def __add__(self, n: int) -> bdl_input_iterator_111: ... - def __iadd__(self, n: int) -> Self: ... - def __sub__(self, n: int) -> bdl_input_iterator_111: ... - def __isub__(self, n: int) -> Self: ... - def __getitem__(self, n: int) -> bdl_input_iterator_111: ... + def __eq__(self, m: object) -> bool: ... + def __ne__(self, m: object) -> bool: ... + def __lt__(self, m: int) -> bool: ... + def __le__(self, m: int) -> bool: ... + def __gt__(self, m: int) -> bool: ... + def __ge__(self, m: int) -> bool: ... + def __add__(self, m: int) -> bdl_input_iterator_111: ... + def __iadd__(self, m: int) -> Self: ... + def __sub__(self, m: int) -> bdl_input_iterator_111: ... + def __isub__(self, m: int) -> Self: ... + def __getitem__(self, m: int) -> bdl_input_iterator_111: ... def num_input_pairs(self) -> int: ... def get_layout(self) -> sidb_layout: ... @@ -1879,8 +1880,8 @@ class sidb_defect: relative_permittivity: float = 0.0, screening_distance: float = 0.0, ) -> None: ... - def __eq__(self, rhs: sidb_defect) -> bool: ... - def __ne__(self, rhs: sidb_defect) -> bool: ... + def __eq__(self, rhs: object) -> bool: ... + def __ne__(self, rhs: object) -> bool: ... type: sidb_defect_type charge: int @@ -1967,7 +1968,9 @@ class charge_distribution_surface_100(sidb_100_lattice): @overload def __init__(self, lyt: charge_distribution_surface_100) -> None: ... def get_all_sidb_locations_in_nm(self) -> list[tuple[float, float, float]]: ... - def assign_cell_type(self, c: sidb_technology.cell_type, ct: int) -> None: ... + def assign_cell_type( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int], ct: sidb_technology.cell_type + ) -> None: ... def assign_physical_parameters(self, params: sidb_simulation_parameters) -> None: ... def get_phys_params(self) -> sidb_simulation_parameters: ... def charge_exists(self, cs: sidb_charge_state) -> bool: ... @@ -2086,11 +2089,6 @@ class charge_distribution_surface_100(sidb_100_lattice): def assign_charge_index_by_two_gray_codes(self, gray_code: int, gray_code_old: int) -> None: ... def get_sidb_order(self) -> list[int]: ... def add_sidb(self, cell: offset_coordinate | tuple[int, int] | tuple[int, int, int], charge: int) -> None: ... - def cells(self) -> list[tuple[int, int, int]]: ... - def pis(self) -> list[tuple[int, int, int]]: ... - def pos(self) -> list[tuple[int, int, int]]: ... - def is_within_bounds(self, c: tuple[int, int, int]) -> bool: ... - def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... class charge_distribution_surface_111(sidb_111_lattice): @overload @@ -2098,14 +2096,16 @@ class charge_distribution_surface_111(sidb_111_lattice): @overload def __init__( self, - lyt: charge_distribution_surface_100, + lyt: sidb_111_lattice, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ..., ) -> None: ... @overload - def __init__(self, lyt: charge_distribution_surface_100) -> None: ... + def __init__(self, lyt: charge_distribution_surface_111) -> None: ... def get_all_sidb_locations_in_nm(self) -> list[tuple[float, float, float]]: ... - def assign_cell_type(self, c: sidb_technology.cell_type, ct: int) -> None: ... + def assign_cell_type( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int], ct: sidb_technology.cell_type + ) -> None: ... def assign_physical_parameters(self, params: sidb_simulation_parameters) -> None: ... def get_phys_params(self) -> sidb_simulation_parameters: ... def charge_exists(self, cs: sidb_charge_state) -> bool: ... @@ -2224,11 +2224,6 @@ class charge_distribution_surface_111(sidb_111_lattice): def assign_charge_index_by_two_gray_codes(self, gray_code: int, gray_code_old: int) -> None: ... def get_sidb_order(self) -> list[int]: ... def add_sidb(self, cell: offset_coordinate | tuple[int, int] | tuple[int, int, int], charge: int) -> None: ... - def cells(self) -> list[tuple[int, int, int]]: ... - def pis(self) -> list[tuple[int, int, int]]: ... - def pos(self) -> list[tuple[int, int, int]]: ... - def is_within_bounds(self, c: tuple[int, int, int]) -> bool: ... - def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... class charge_distribution_surface(sidb_layout): @overload @@ -2236,14 +2231,16 @@ class charge_distribution_surface(sidb_layout): @overload def __init__( self, - lyt: charge_distribution_surface_100, + lyt: sidb_layout, params: sidb_simulation_parameters = ..., cs: sidb_charge_state = ..., ) -> None: ... @overload - def __init__(self, lyt: charge_distribution_surface_100) -> None: ... + def __init__(self, lyt: charge_distribution_surface) -> None: ... def get_all_sidb_locations_in_nm(self) -> list[tuple[float, float, float]]: ... - def assign_cell_type(self, c: sidb_technology.cell_type, ct: int) -> None: ... + def assign_cell_type( + self, c: offset_coordinate | tuple[int, int] | tuple[int, int, int], ct: sidb_technology.cell_type + ) -> None: ... def assign_physical_parameters(self, params: sidb_simulation_parameters) -> None: ... def get_phys_params(self) -> sidb_simulation_parameters: ... def charge_exists(self, cs: sidb_charge_state) -> bool: ... @@ -2362,11 +2359,6 @@ class charge_distribution_surface(sidb_layout): def assign_charge_index_by_two_gray_codes(self, gray_code: int, gray_code_old: int) -> None: ... def get_sidb_order(self) -> list[int]: ... def add_sidb(self, cell: offset_coordinate | tuple[int, int] | tuple[int, int, int], charge: int) -> None: ... - def cells(self) -> list[tuple[int, int, int]]: ... - def pis(self) -> list[tuple[int, int, int]]: ... - def pos(self) -> list[tuple[int, int, int]]: ... - def is_within_bounds(self, c: tuple[int, int, int]) -> bool: ... - def bounding_box_2d(self) -> tuple[tuple[int, int], tuple[int, int]]: ... @overload def exhaustive_ground_state_simulation( @@ -2391,11 +2383,10 @@ def sidb_nm_position( lyt: charge_distribution_surface | sidb_layout | sidb_100_lattice | sidb_111_lattice, c: offset_coordinate | tuple[int, int] | tuple[int, int, int], ) -> tuple[float, float]: ... -def sidb_nm_distance_111( - lyt: sidb_111_lattice, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] -) -> tuple[float, float]: ... -def sidb_nm_distance_100( - lyt: sidb_100_lattice, c: offset_coordinate | tuple[int, int] | tuple[int, int, int] +def sidb_nm_distance( + lyt: sidb_100_lattice | sidb_111_lattice, + source: offset_coordinate | tuple[int, int] | tuple[int, int, int], + target: offset_coordinate | tuple[int, int] | tuple[int, int, int], ) -> tuple[float, float]: ... class transition_type(Enum): @@ -2432,7 +2423,7 @@ class bdl_wire_selection(Enum): INPUT: ... OUTPUT: ... -class bdl_wire_100(sidb_100_lattice): +class bdl_wire_100: def __init__(self, p: list[bdl_pair]) -> None: ... pairs: list[bdl_pair] @@ -2440,7 +2431,7 @@ class bdl_wire_100(sidb_100_lattice): first_bdl_pair: bdl_pair last_bdl_pair: bdl_pair -class bdl_wire_111(sidb_111_lattice): +class bdl_wire_111: def __init__(self, p: list[bdl_pair]) -> None: ... pairs: list[bdl_pair] @@ -2452,7 +2443,7 @@ class detect_bdl_wires_params: def __init__(self) -> None: ... threshold_bdl_interdistance: float - bdl_pairs_params: object + bdl_pairs_params: detect_bdl_wires_params def detect_bdl_wires_100( lyt: sidb_100_lattice, params: detect_bdl_wires_params = ..., wire_selection: bdl_wire_selection = ... @@ -2484,7 +2475,7 @@ class is_operational_params: @overload def is_operational( lyt: sidb_100_lattice, - spec: object, + spec: list[dynamic_truth_table], params: is_operational_params = ..., input_bdl_wire: bdl_wire_100 | None = None, output_bdl_wire: bdl_wire_100 | None = None, @@ -2492,7 +2483,7 @@ def is_operational( @overload def is_operational( lyt: sidb_100_lattice, - spec: object, + spec: list[dynamic_truth_table], params: is_operational_params = ..., input_bdl_wire: bdl_wire_111 | None = None, output_bdl_wire: bdl_wire_111 | None = None, @@ -2500,27 +2491,36 @@ def is_operational( @overload def operational_input_patterns( lyt: sidb_100_lattice, - spec: object, # Type depends on the specification + spec: list[dynamic_truth_table], params: is_operational_params = ..., ) -> list[int]: ... @overload def operational_input_patterns( lyt: sidb_111_lattice, - spec: object, # Type depends on the specification + spec: list[dynamic_truth_table], params: is_operational_params = ..., -) -> list[int]: ... +) -> set[int]: ... +@overload def is_kink_induced_non_operational( - lyt: sidb_100_lattice | sidb_111_lattice, - spec: object, + lyt: sidb_100_lattice, + spec: list[dynamic_truth_table], params: is_operational_params = ..., - input_bdl_wire: object | None = None, - output_bdl_wire: object | None = None, + input_bdl_wire: list[bdl_wire_100] | None = None, + output_bdl_wire: list[bdl_wire_100] | None = None, +) -> operational_status: ... +@overload +def is_kink_induced_non_operational( + lyt: sidb_111_lattice, + spec: list[dynamic_truth_table], + params: is_operational_params = ..., + input_bdl_wire: list[bdl_wire_111] | None = None, + output_bdl_wire: list[bdl_wire_111] | None = None, ) -> operational_status: ... def kink_induced_non_operational_input_patterns( lyt: sidb_100_lattice | sidb_111_lattice, - spec: object, + spec: list[dynamic_truth_table], params: is_operational_params = ..., -) -> object: ... +) -> set[int]: ... # QuickExact class quickexact_params: @@ -2576,8 +2576,8 @@ def critical_temperature_non_gate_based( class parameter_point: def __init__(self, values: list[float] | None = None) -> None: ... def __hash__(self) -> int: ... - def __eq__(self, other: parameter_point) -> bool: ... - def __ne__(self, other: parameter_point) -> bool: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... parameters: list[float] @@ -2603,7 +2603,7 @@ class operational_domain_value_range: class operational_domain_params: def __init__(self) -> None: ... - operational_params: dict[str, float] + operational_params: is_operational_params sweep_dimensions: list[operational_domain_value_range] class operational_domain_stats: diff --git a/bindings/mnt/pyfiction/test/algorithms/physical_design/test_post_layout_optimization.py b/bindings/mnt/pyfiction/test/algorithms/physical_design/test_post_layout_optimization.py index 100fd3e5c..a274db3d6 100644 --- a/bindings/mnt/pyfiction/test/algorithms/physical_design/test_post_layout_optimization.py +++ b/bindings/mnt/pyfiction/test/algorithms/physical_design/test_post_layout_optimization.py @@ -49,7 +49,7 @@ def test_post_layout_optimization_with_stats(self): post_layout_optimization(layout, statistics=stats) self.assertEqual(equivalence_checking(network, layout), eq_type.STRONG) - self.assertGreater(stats.time_total.total_seconds(), 0) + self.assertGreater(stats.time_total, 0) self.assertEqual(stats.x_size_before, 6) self.assertEqual(stats.y_size_before, 8) self.assertEqual(stats.x_size_after, 6) @@ -71,7 +71,7 @@ def test_post_layout_optimization_with_stats_and_parameters(self): post_layout_optimization(layout, params, statistics=stats) self.assertEqual(equivalence_checking(network, layout), eq_type.STRONG) - self.assertGreater(stats.time_total.total_seconds(), 0) + self.assertGreater(stats.time_total, 0) self.assertEqual(stats.x_size_before, 6) self.assertEqual(stats.y_size_before, 8) self.assertEqual(stats.x_size_after, 6) diff --git a/bindings/mnt/pyfiction/test/algorithms/physical_design/test_wiring_reduction.py b/bindings/mnt/pyfiction/test/algorithms/physical_design/test_wiring_reduction.py index d8047d200..93687608b 100644 --- a/bindings/mnt/pyfiction/test/algorithms/physical_design/test_wiring_reduction.py +++ b/bindings/mnt/pyfiction/test/algorithms/physical_design/test_wiring_reduction.py @@ -49,7 +49,7 @@ def test_wiring_reduction_with_stats(self): wiring_reduction(layout, statistics=stats) self.assertEqual(equivalence_checking(network, layout), eq_type.STRONG) - self.assertGreater(stats.time_total.total_seconds(), 0) + self.assertGreater(stats.time_total, 0) self.assertEqual(stats.x_size_before, 6) self.assertEqual(stats.y_size_before, 8) self.assertEqual(stats.x_size_after, 6) @@ -73,7 +73,7 @@ def test_wiring_reduction_with_stats_and_parameters(self): wiring_reduction(layout, params, stats) self.assertEqual(equivalence_checking(network, layout), eq_type.STRONG) - self.assertGreater(stats.time_total.total_seconds(), 0) + self.assertGreater(stats.time_total, 0) self.assertEqual(stats.x_size_before, 6) self.assertEqual(stats.y_size_before, 8) self.assertEqual(stats.x_size_after, 6) diff --git a/bindings/mnt/pyfiction/test/technology/test_sidb_nm_distance.py b/bindings/mnt/pyfiction/test/technology/test_sidb_nm_distance.py index 29e506419..3e02c23a3 100644 --- a/bindings/mnt/pyfiction/test/technology/test_sidb_nm_distance.py +++ b/bindings/mnt/pyfiction/test/technology/test_sidb_nm_distance.py @@ -1,6 +1,6 @@ import unittest -from mnt.pyfiction import sidb_100_lattice, sidb_111_lattice, sidb_nm_distance_100, sidb_nm_distance_111 +from mnt.pyfiction import sidb_100_lattice, sidb_111_lattice, sidb_nm_distance class TestSiDBNmDistance(unittest.TestCase): @@ -8,25 +8,25 @@ def test_sidb_nm_distance_100_lattice(self): layout_one = sidb_100_lattice((10, 10)) # Replace the placeholders with actual values or function calls - self.assertEqual(sidb_nm_distance_100(layout_one, (0, 0), (0, 0)), 0) - self.assertEqual(sidb_nm_distance_100(layout_one, (1, 0), (1, 0)), 0) - self.assertEqual(sidb_nm_distance_100(layout_one, (1, 1), (1, 1)), 0) + self.assertEqual(sidb_nm_distance(layout_one, (0, 0), (0, 0)), 0) + self.assertEqual(sidb_nm_distance(layout_one, (1, 0), (1, 0)), 0) + self.assertEqual(sidb_nm_distance(layout_one, (1, 1), (1, 1)), 0) # Replace the placeholders with actual values or function calls - self.assertAlmostEqual(sidb_nm_distance_100(layout_one, (0, 0), (2, 0)), 2 * 0.384) - self.assertAlmostEqual(sidb_nm_distance_100(layout_one, (0, 0), (0, 1)), 0.225) + self.assertAlmostEqual(sidb_nm_distance(layout_one, (0, 0), (2, 0)), 2 * 0.384) + self.assertAlmostEqual(sidb_nm_distance(layout_one, (0, 0), (0, 1)), 0.225) def test_sidb_nm_distance_111_lattice(self): layout_one = sidb_111_lattice((10, 10)) # Replace the placeholders with actual values or function calls - self.assertEqual(sidb_nm_distance_111(layout_one, (0, 0), (0, 0)), 0) - self.assertEqual(sidb_nm_distance_111(layout_one, (1, 0), (1, 0)), 0) - self.assertEqual(sidb_nm_distance_111(layout_one, (1, 1), (1, 1)), 0) + self.assertEqual(sidb_nm_distance(layout_one, (0, 0), (0, 0)), 0) + self.assertEqual(sidb_nm_distance(layout_one, (1, 0), (1, 0)), 0) + self.assertEqual(sidb_nm_distance(layout_one, (1, 1), (1, 1)), 0) # Replace the placeholders with actual values or function calls - self.assertAlmostEqual(sidb_nm_distance_111(layout_one, (0, 0), (2, 0)), 1.33) - self.assertAlmostEqual(sidb_nm_distance_111(layout_one, (0, 0), (0, 1)), 0.3839967) + self.assertAlmostEqual(sidb_nm_distance(layout_one, (0, 0), (2, 0)), 1.33) + self.assertAlmostEqual(sidb_nm_distance(layout_one, (0, 0), (0, 1)), 0.3839967) if __name__ == "__main__": diff --git a/include/fiction/technology/sidb_lattice.hpp b/include/fiction/technology/sidb_lattice.hpp index 60781e766..96c37d269 100644 --- a/include/fiction/technology/sidb_lattice.hpp +++ b/include/fiction/technology/sidb_lattice.hpp @@ -64,7 +64,7 @@ class sidb_lattice : public Lyt * @param ar Highest possible position in the layout. * @param name Layout name. */ - explicit sidb_lattice(const aspect_ratio& ar, const std::string& name = "") : Lyt(ar, name) + explicit sidb_lattice(const aspect_ratio& ar = {}, const std::string& name = "") : Lyt(ar, name) { static_assert(is_cell_level_layout_v, "Lyt is not a cell-level layout"); static_assert(has_sidb_technology_v, "Lyt is not an SiDB layout");