-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ✨ Exposed further truth table operators and functions * ✨ Exposed node simulation * 👷 Added Python 3.13 to the `noxfile.py` configuration * 📝 Mention the new functions in the README
- Loading branch information
Showing
10 changed files
with
311 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
bindings/aigverse/include/aigverse/truth_tables/operations.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// Created by marcel on 12.12.24. | ||
// | ||
|
||
#ifndef AIGVERSE_OPERATIONS_HPP | ||
#define AIGVERSE_OPERATIONS_HPP | ||
|
||
#include "aigverse/types.hpp" | ||
|
||
#include <kitty/dynamic_truth_table.hpp> | ||
#include <kitty/operations.hpp> | ||
#include <pybind11/pybind11.h> | ||
|
||
namespace aigverse | ||
{ | ||
|
||
namespace detail | ||
{ | ||
|
||
inline void truth_table_operations(pybind11::module& m) | ||
{ | ||
using namespace pybind11::literals; | ||
|
||
m.def( | ||
"ternary_majority", | ||
[](const aigverse::truth_table& a, const aigverse::truth_table& b, | ||
const aigverse::truth_table& c) -> aigverse::truth_table { return kitty::ternary_majority(a, b, c); }, | ||
"a"_a, "b"_a, "c"_a, "Compute the ternary majority of three truth tables."); | ||
|
||
m.def( | ||
"cofactor0", [](const aigverse::truth_table& tt, const uint8_t var_index) -> aigverse::truth_table | ||
{ return kitty::cofactor0(tt, var_index); }, | ||
"Returns the cofactor with respect to 0 of the variable at index `var_index` in the given truth table."); | ||
m.def( | ||
"cofactor1", [](const aigverse::truth_table& tt, const uint8_t var_index) -> aigverse::truth_table | ||
{ return kitty::cofactor1(tt, var_index); }, | ||
"Returns the cofactor with respect to 1 of the variable at index `var_index` in the given truth table."); | ||
} | ||
|
||
} // namespace detail | ||
|
||
inline void truth_table_operations(pybind11::module& m) | ||
{ | ||
detail::truth_table_operations(m); | ||
} | ||
|
||
} // namespace aigverse | ||
|
||
#endif // AIGVERSE_OPERATIONS_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.