Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

✨ Add function to detect if non-operational status is due to wire kink #587

Merged
merged 58 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
761bb74
:sparkles: add function to detect if non-operational status is due to…
Drewniok Nov 19, 2024
2cabaa9
:memo: Update pyfiction docstrings
actions-user Nov 19, 2024
29c467e
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Nov 19, 2024
e7d31f2
:memo: update.
Drewniok Nov 19, 2024
8b3afc2
:art: small fix.
Drewniok Nov 19, 2024
f929d98
:art: small fix.
Drewniok Nov 19, 2024
59f293f
:memo: Update pyfiction docstrings
actions-user Nov 19, 2024
f53ada0
:art: small fix.
Drewniok Nov 19, 2024
2233a16
Merge remote-tracking branch 'origin/add_non_operational_due_to_kinks…
Drewniok Nov 19, 2024
76ff921
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Nov 19, 2024
8544f02
:memo: Update pyfiction docstrings
actions-user Nov 19, 2024
25421de
:art: small fix.
Drewniok Nov 19, 2024
9f7d29e
:art: small fix.
Drewniok Nov 19, 2024
621a388
:memo: Update pyfiction docstrings
actions-user Nov 19, 2024
e434ed4
:memo: small fix.
Drewniok Nov 19, 2024
7f4ff4e
Merge remote-tracking branch 'origin/add_non_operational_due_to_kinks…
Drewniok Nov 19, 2024
9f9c3a6
:memo: small fix.
Drewniok Nov 19, 2024
0c429aa
:memo: Update pyfiction docstrings
actions-user Nov 19, 2024
9d7f9b7
:memo: small fix.
Drewniok Nov 19, 2024
f273911
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Nov 19, 2024
58fe419
:memo: Update pyfiction docstrings
actions-user Nov 19, 2024
4da2c16
:memo: small update.
Drewniok Nov 19, 2024
9b53a97
:memo: Update pyfiction docstrings
actions-user Nov 19, 2024
728b29d
:memo: small update.
Drewniok Nov 19, 2024
42f043b
Merge remote-tracking branch 'origin/add_non_operational_due_to_kinks…
Drewniok Nov 19, 2024
c3a2fae
:memo: small update.
Drewniok Nov 19, 2024
60f72a2
:art: add missing header.
Drewniok Nov 19, 2024
ff8da28
:art: implement first batch of Marcel's comments.
Drewniok Nov 19, 2024
c5e6a03
:memo: Update pyfiction docstrings
actions-user Nov 19, 2024
c0dce61
:art: small fix.
Drewniok Nov 19, 2024
f6daadd
Merge remote-tracking branch 'origin/add_non_operational_due_to_kinks…
Drewniok Nov 20, 2024
adc4ab3
:art: implement Marcel's comments.
Drewniok Nov 20, 2024
4e8507c
:memo: Update pyfiction docstrings
actions-user Nov 20, 2024
b8abb0f
:art: small fix.
Drewniok Nov 21, 2024
9684552
:memo: Update pyfiction docstrings
actions-user Nov 21, 2024
ce3fad5
Merge branch 'refs/heads/main' into add_non_operational_due_to_kinks_…
Drewniok Nov 24, 2024
bc296a4
:art: implement Marcel's feedback.
Drewniok Nov 24, 2024
579a586
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Nov 24, 2024
8e8ad1e
:memo: Update pyfiction docstrings
actions-user Nov 24, 2024
47a32fd
:art: implement Marcel's feedback.
Drewniok Nov 24, 2024
68afcef
:art: small fix.
Drewniok Nov 24, 2024
ddc821a
:art: small fix.
Drewniok Nov 24, 2024
9cef726
:white_check_mark: update python unit tests.
Drewniok Nov 24, 2024
19a6c6c
Merge branch 'main' into add_non_operational_due_to_kinks_func
Drewniok Nov 24, 2024
489879c
:art: small bug fix and add unit test.
Drewniok Nov 25, 2024
b56ccb5
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Nov 25, 2024
09f76a7
:white_check_mark: add test.
Drewniok Nov 25, 2024
d80c86d
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Nov 25, 2024
f220343
:white_check_mark: add test.
Drewniok Nov 25, 2024
aa99e67
Merge remote-tracking branch 'origin/add_non_operational_due_to_kinks…
Drewniok Nov 25, 2024
adf7f79
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Nov 25, 2024
3ab2bba
:art: implement Marcel's feedback.
Drewniok Nov 25, 2024
fd4c026
🎨 Incorporated pre-commit fixes
pre-commit-ci[bot] Nov 25, 2024
ab55bc4
:memo: update changelog.rst
Drewniok Nov 25, 2024
357754b
Merge remote-tracking branch 'origin/add_non_operational_due_to_kinks…
Drewniok Nov 25, 2024
6c2443b
:art: implement Marcel's feedback.
Drewniok Nov 25, 2024
32746e5
:memo: Update pyfiction docstrings
actions-user Nov 25, 2024
6cfaafb
Merge branch 'main' into add_non_operational_due_to_kinks_func
Drewniok Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

#include <string>
#include <optional>

Drewniok marked this conversation as resolved.
Show resolved Hide resolved
namespace pyfiction
{
Expand All @@ -32,6 +32,14 @@ void is_operational(pybind11::module& m)

m.def("operational_input_patterns", &fiction::operational_input_patterns<Lyt, py_tt>, "lyt"_a, "spec"_a,
"params"_a = fiction::is_operational_params{}, DOC(fiction_operational_input_patterns));

m.def("is_non_operational_due_to_kinks", &fiction::is_non_operational_due_to_kinks<Lyt, py_tt>, "lyt"_a, "spec"_a,
"params"_a = fiction::is_operational_params{}, "input_bdl_wire"_a = std::nullopt,
"output_bdl_wire"_a = std::nullopt, DOC(fiction_is_non_operational_due_to_kinks));

m.def("non_operational_input_patterns_due_to_kinks",
&fiction::non_operational_input_patterns_due_to_kinks<Lyt, py_tt>, "lyt"_a, "spec"_a,
"params"_a = fiction::is_operational_params{}, DOC(fiction_non_operational_input_patterns_due_to_kinks));
}

} // namespace detail
Expand Down
80 changes: 73 additions & 7 deletions bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6801,12 +6801,19 @@ Parameter ``current_input_index``:
`true` if any output wire contains a kink (i.e., an unexpected
charge state), `false` otherwise.)doc";

static const char *__doc_fiction_detail_is_operational_impl_determine_operational_input_patterns =
R"doc(Determines the input combinations yielding the correct output.
static const char *__doc_fiction_detail_is_operational_impl_determine_non_operational_input_patterns_and_op_status_due_kinks =
R"doc(Determines the input combinations yielding the wrong output and the
information if non-operational status is due to kinks. `True`
indicates that the layout is non-operational due to kinks, `false`
otherwise.

Returns:
All inputs (e.g. 2-input Boolean function: 00 ^= 0; 10 ^= 2) for
which the correct output is computed.)doc";
Set of pairs where the first element is a the the input paattern
(e.g. 2-input Boolean function: 00 ^= 0; 10 ^= 2) for which the
wrong output is computed. The second entry indicates the
information if the non-operational status is due to kinks. `True`
indicates that the layout is non-operational due to kinks, `false`
otherwise.)doc";

static const char *__doc_fiction_detail_is_operational_impl_encodes_bit_one =
R"doc(This function returns `true` if `1` is encoded in the charge state of
Expand Down Expand Up @@ -6848,6 +6855,13 @@ R"doc(Returns the total number of simulator invocations.

static const char *__doc_fiction_detail_is_operational_impl_input_bdl_wires = R"doc(Input BDL wires.)doc";

static const char *__doc_fiction_detail_is_operational_impl_is_non_operational_due_to_kinks =
R"doc(Returns whether the layout is non-operational due to kinks.

Returns:
`true` if the layout is non-operational due to kinks, `false`
otherwise.)doc";

static const char *__doc_fiction_detail_is_operational_impl_is_operational_impl =
R"doc(Constructor to initialize the algorithm with a layout and parameters.

Expand Down Expand Up @@ -6882,6 +6896,8 @@ Parameter ``output_wires``:

static const char *__doc_fiction_detail_is_operational_impl_layout = R"doc(SiDB cell-level layout.)doc";

static const char *__doc_fiction_detail_is_operational_impl_non_operational_due_to_kinks = R"doc(Indicates whether the layout is non-operational due to kinks.)doc";

static const char *__doc_fiction_detail_is_operational_impl_output_bdl_pairs = R"doc(Output BDL pairs.)doc";

static const char *__doc_fiction_detail_is_operational_impl_output_bdl_wires = R"doc(Output BDL wires.)doc";
Expand Down Expand Up @@ -13663,6 +13679,36 @@ Parameter ``defect``:
Returns:
`true` iff `defect` has a neutral charge value.)doc";

static const char *__doc_fiction_is_non_operational_due_to_kinks =
R"doc(Determines if the layout is non-operational due to kinks.

Template parameter ``Lyt``:
SiDB cell-level layout type.

Template parameter ``TT``:
The type of the truth table specifying the layout behavior.

Parameter ``lyt``:
The SiDB cell-level layout to be checked.

Parameter ``spec``:
Expected Boolean function of the layout given as a multi-output
truth table.

Parameter ``params``:
Parameters for the `is_operational` algorithm.

Parameter ``input_bdl_wire``:
Optional BDL input wires of lyt.

Parameter ``output_bdl_wire``:
Optional BDL output wires of lyt.

Returns:
Bool that indicates whether the layout is non-operational due to
kinks. `true` if the layout is not usable due to kinks, `false`
otherwise.)doc";

static const char *__doc_fiction_is_operational =
R"doc(Determine the operational status of an SiDB layout.

Expand Down Expand Up @@ -13693,9 +13739,6 @@ Parameter ``input_bdl_wire``:
Parameter ``output_bdl_wire``:
Optional BDL output wires of lyt.

Parameter ``input_bdl_wire_direction``:
Optional BDL input wire directions of lyt.

Returns:
A pair containing the operational status of the gate layout
(either `OPERATIONAL` or `NON_OPERATIONAL`) and the number of
Expand Down Expand Up @@ -14086,6 +14129,29 @@ Parameter ``file``:
Parameter ``rfun``:
The actual parsing function.)doc";

static const char *__doc_fiction_non_operational_input_patterns_due_to_kinks =
R"doc(This function determines the input combinations for which the SiDB-
based logic, represented by the provided layout (`lyt`) and truth
table specifications (`spec`), are non-operational due to kinks.

Template parameter ``Lyt``:
Type of the cell-level layout.

Template parameter ``TT``:
Type of the truth table.

Parameter ``lyt``:
The SiDB layout.

Parameter ``spec``:
Vector of truth table specifications.

Parameter ``params``:
Parameters to simulate if a input combination is operational.

Returns:
The non-operational input combinations due to kinks.)doc";

static const char *__doc_fiction_normalize_layout_coordinates =
R"doc(A new layout is constructed and returned that is equivalent to the
given cell-level layout. However, its coordinates are normalized,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,29 @@ def test_and_gate_kinks(self):

self.assertEqual(op_status, operational_status.NON_OPERATIONAL)


def test_and_gate_non_operational_due_to_kinks(self):

lyt = read_sqd_layout_100(dir_path + "/../../../resources/AND_mu_032_kinks.sqd")

params = is_operational_params()
params.simulation_parameters = sidb_simulation_parameters(2, -0.32)

result = is_non_operational_due_to_kinks(lyt, [create_and_tt()], params)

self.assertTrue(result)

def test_and_gate_non_operational_input_patterns_due_to_kinks(self):

lyt = read_sqd_layout_100(dir_path + "/../../../resources/AND_mu_032_kinks.sqd")

params = is_operational_params()
params.simulation_parameters = sidb_simulation_parameters(2, -0.32)

non_operational_pattern_kinks = non_operational_input_patterns_due_to_kinks(lyt, [create_and_tt()], params)

self.assertEqual(non_operational_pattern_kinks, {1, 2})

def test_and_gate_111_lattice_11_input_pattern(self):
lyt = read_sqd_layout_111(dir_path + "/../../../resources/AND_mu_032_111_surface.sqd")

Expand Down
4 changes: 4 additions & 0 deletions docs/algorithms/sidb_simulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ Operational Domain Computation
:members:
.. doxygenfunction:: fiction::is_operational
.. doxygenfunction:: fiction::operational_input_patterns
.. doxygenfunction:: fiction::is_non_operational_due_to_kinks
.. doxygenfunction:: fiction::non_operational_input_patterns_due_to_kinks

**Header:** ``fiction/algorithms/simulation/sidb/operational_domain.hpp``

Expand Down Expand Up @@ -274,6 +276,8 @@ Operational Domain Computation
:members:
.. autofunction:: mnt.pyfiction.is_operational
.. autofunction:: mnt.pyfiction.operational_input_patterns
.. autofunction:: mnt.pyfiction.is_non_operational_due_to_kinks
.. autofunction:: mnt.pyfiction.non_operational_input_patterns_due_to_kinks

.. autoclass:: mnt.pyfiction.sweep_parameter
:members:
Expand Down
Loading
Loading