BDL Input Iterator¶
Header: fiction/technology/sidb/simulation/logic/bdl_input_iterator.hpp
-
struct bdl_input_iterator_params¶
Parameters for the BDL input iterator.
Public Types
-
enum class input_bdl_configuration : uint8_t¶
This enum defines how BDL inputs are manipulated within the algorithm. According to existing literature, there are two main approaches for handling BDL inputs:
Distance Encoding, in which an input of
1is generated by placing a perturber closer to the target, whereas a0is produced by positioning the perturber farther away (as described in https://dl.acm.org/doi/10.1145/3489517.3530525).Absence Encoding, in which a perturber is used to set the input to
1, while the absence of a perturber represents a0(as described in https://ieeexplore.ieee.org/abstract/document/8963859).
Values:
-
enumerator PERTURBER_DISTANCE_ENCODED¶
An input of
1is generated by placing a perturber closer to the BDL wire, whereas a0is produced by positioning the perturber farther away (as described in https://dl.acm.org/doi/10.1145/3489517.3530525).
-
enumerator PERTURBER_ABSENCE_ENCODED¶
A perturber is used to set the input to
1, while the absence of a perturber represents a0(as described in https://ieeexplore.ieee.org/abstract/document/8963859).
Public Members
-
detect_bdl_wires_params bdl_wire_params = {}¶
Parameters to detect BDL wires.
-
input_bdl_configuration input_bdl_config = {input_bdl_configuration::PERTURBER_DISTANCE_ENCODED}¶
The
input_bdl_configmember allows selection between different modes for handling input BDLs.
-
enum class input_bdl_configuration : uint8_t¶
-
class bdl_input_iterator¶
Iterator that assigns the input patterns to the input BDL pairs of an SiDB layout. Incrementing the iterator advances the input pattern; dereferencing it yields the layout with that pattern applied. Every input BDL pair encodes one bit: a
1keeps the SiDB closer to the wire’s end, a0keeps the other one (perturber-distance encoding) or none (perturber-absence encoding). Bitiof the pattern belongs to thei-th input pair in layout order, with the first pair as the most significant bit.Public Functions
-
inline explicit bdl_input_iterator(const layout &source_layout, const bdl_input_iterator_params &ps = {})¶
Detects the input BDL pairs and wires of
source_layoutand applies input pattern0.- Parameters:
source_layout – The layout to iterate over.
ps – Parameters for the BDL pair and wire detection and the input encoding.
- Throws:
std::invalid_argument – if the layout has more than 63 input BDL pairs.
-
inline bdl_input_iterator(const layout &source_layout, const bdl_input_iterator_params &ps, const std::vector<bdl_wire> &source_input_wires)¶
Like the constructor above but with input wires that are already known.
- Parameters:
source_layout – The layout to iterate over.
ps – Parameters for the BDL pair detection and the input encoding.
source_input_wires – The input wires of
source_layout.
- Throws:
std::invalid_argument – if the layout has more than 63 input BDL pairs.
-
inline const layout &operator*() const noexcept¶
The layout with the current input pattern applied.
- Returns:
The layout.
-
inline bdl_input_iterator &operator++() noexcept¶
Advances to the next input pattern.
- Returns:
Reference to
this.
-
inline bdl_input_iterator operator++(int) noexcept¶
Advances to the next input pattern.
- Returns:
Copy of
thisbefore the increment.
-
inline bdl_input_iterator operator+(const int m) const noexcept¶
Returns an iterator
mpatterns ahead.- Parameters:
m – The number of patterns to advance.
- Returns:
The advanced iterator.
-
inline bdl_input_iterator &operator+=(const int m) noexcept¶
Advances by
mpatterns.- Parameters:
m – The number of patterns to advance.
- Returns:
Reference to
this.
-
inline bdl_input_iterator operator-(const int m) const noexcept¶
Returns an iterator
mpatterns behind.- Parameters:
m – The number of patterns to go back.
- Returns:
The iterator.
-
inline bdl_input_iterator &operator--() noexcept¶
Goes back to the previous input pattern.
- Returns:
Reference to
this.
-
inline bdl_input_iterator operator--(int) noexcept¶
Goes back to the previous input pattern.
- Returns:
Copy of
thisbefore the decrement.
-
inline bdl_input_iterator &operator-=(const int m) noexcept¶
Goes back by
mpatterns.- Parameters:
m – The number of patterns to go back.
- Returns:
Reference to
this.
-
inline bdl_input_iterator &operator=(const uint64_t m) noexcept¶
Jumps to input pattern
m.- Parameters:
m – The input pattern.
- Returns:
Reference to
this.
-
inline bdl_input_iterator operator[](const int m) const noexcept¶
Returns an iterator
mpatterns ahead.- Parameters:
m – The number of patterns to advance.
- Returns:
The advanced iterator.
-
inline int64_t operator-(const bdl_input_iterator &other) const noexcept¶
Distance between two iterators in input patterns.
- Parameters:
other – The other iterator.
- Returns:
thispattern minusother’s pattern.
-
inline auto operator<=>(const uint64_t m) const noexcept¶
Compares the current input pattern with
m.- Parameters:
m – The pattern to compare with.
- Returns:
The three-way comparison result.
-
inline bool operator==(const uint64_t m) const noexcept¶
Whether the current input pattern is
m.- Parameters:
m – The pattern to compare with.
- Returns:
trueif the patterns are equal.
-
inline uint64_t num_input_pairs() const noexcept¶
Number of input BDL pairs.
- Returns:
The number of input pairs.
-
inline bool is_valid() const noexcept¶
Whether every input BDL pair belongs to a complete detected wire.
- Returns:
trueif input patterns can be applied.
-
inline uint64_t get_current_input_index() const noexcept¶
The current input pattern.
- Returns:
The pattern.
-
inline explicit bdl_input_iterator(const layout &source_layout, const bdl_input_iterator_params &ps = {})¶
-
inline std::vector<layout> fiction::sidb::simulation::logic::generate_bdl_input_pattern_layouts(const layout &lyt, const bdl_input_iterator_params &ps = {})¶
Applies every input pattern to the input BDL pairs of a layout and returns the resulting layouts, pattern
0first; the input wires are detected first.- Parameters:
lyt – The layout.
ps – Parameters for the BDL detection and the input encoding.
- Throws:
std::invalid_argument – if the layout has more than 63 input BDL pairs.
- Returns:
One layout per input pattern.
-
inline std::vector<layout> fiction::sidb::simulation::logic::generate_bdl_input_pattern_layouts(const layout &lyt, const bdl_input_iterator_params &ps, const std::vector<bdl_wire> &input_wires)¶
Applies every input pattern to the input BDL pairs of a layout and returns the resulting layouts, pattern
0first, with the input wires given by the caller.- Parameters:
lyt – The layout.
ps – Parameters for the BDL pair detection and the input encoding.
input_wires – The input wires of
lyt.
- Throws:
std::invalid_argument – if the layout has more than 63 input BDL pairs.
- Returns:
One layout per input pattern.
- class input_bdl_configuration(*values)¶
- PERTURBER_ABSENCE_ENCODED = 1¶
- PERTURBER_DISTANCE_ENCODED = 0¶
- class bdl_input_iterator(lyt: sidb_layout, *, threshold_bdl_interdistance: float = 2.0, minimum_distance: float = 0.75, maximum_distance: float = 1.5, input_bdl_config: input_bdl_configuration = input_bdl_configuration.PERTURBER_DISTANCE_ENCODED)¶
- class bdl_input_iterator(lyt: sidb_layout, input_wires: Sequence[bdl_wire], *, minimum_distance: float = 0.75, maximum_distance: float = 1.5, input_bdl_config: input_bdl_configuration = input_bdl_configuration.PERTURBER_DISTANCE_ENCODED)
Iterator that assigns the input patterns to the input BDL pairs of an SiDB layout. Incrementing the iterator advances the input pattern; dereferencing it yields the layout with that pattern applied. Every input BDL pair encodes one bit: a
1keeps the SiDB closer to the wire’s end, a0keeps the other one (perturber-distance encoding) or none (perturber-absence encoding). Bitiof the pattern belongs to thei-th input pair in layout order, with the first pair as the most significant bit.- get_layout() sidb_layout¶
Returns the layout that represents the current input state, equivalent to dereferencing the iterator.
- generate_bdl_input_pattern_layouts(lyt: sidb_layout, *, threshold_bdl_interdistance: float = 2.0, minimum_distance: float = 0.75, maximum_distance: float = 1.5, input_bdl_config: input_bdl_configuration = input_bdl_configuration.PERTURBER_DISTANCE_ENCODED) list[sidb_layout]¶
- generate_bdl_input_pattern_layouts(lyt: sidb_layout, input_wires: Sequence[bdl_wire], *, minimum_distance: float = 0.75, maximum_distance: float = 1.5, input_bdl_config: input_bdl_configuration = input_bdl_configuration.PERTURBER_DISTANCE_ENCODED) list[sidb_layout]
Overloaded function.
Overload 1
Return one SiDB layout per input pattern, starting with pattern zero. The keyword options select BDL detection and input encoding. The overload with input_wires bypasses automatic wire detection.
- Parameters:
threshold_bdl_interdistance – Maximum separation between BDL pairs in one wire in nm.
minimum_distance – Minimum SiDB separation for a BDL pair in nm.
maximum_distance – Maximum SiDB separation for a BDL pair in nm.
input_bdl_config – Input encoding: perturber absence or perturber distance.
Overload 2
Return one SiDB layout per input pattern, starting with pattern zero. The keyword options select BDL detection and input encoding. The overload with input_wires bypasses automatic wire detection.
- Parameters:
minimum_distance – Minimum SiDB separation for a BDL pair in nm.
maximum_distance – Maximum SiDB separation for a BDL pair in nm.
input_bdl_config – Input encoding: perturber absence or perturber distance.