cana.utils module
- cana.utils.flip_bitset_in_strstates(strstates, idxs)[source]
Flips the binary value for a set of bits in a binary state.
- Parameters:
binstate (string) – The binary state to flip.
idxs (int) – The indexes of the bits to flip.
- Returns:
The flipped states
- Return type:
(list)
Example
>>> flip_bit_in_strstates('000',[0, 2]) ['100','001']
- cana.utils.flip_binstate_bit_set(binstate, idxs)[source]
Flips the binary value for a set of bits in a binary state.
- Parameters:
binstate (string) – The binary state to flip.
idxs (int) – The indexes of the bits to flip.
- Returns:
The flipped states
- Return type:
(list)
- cana.utils.negate_LUT_input(outputs, idx)[source]
Negate one LUT input; deprecated alias of
BitLut.negate_input().Deprecated since version Use:
cana.function_outputs.bit_lut.BitLut.negate_input()instead.- Parameters:
outputs (list) – The output list defining the LUT.
idx (int) – The index of the input to negate.
- Returns:
The new output with input idx negated
- Return type:
(list)
- cana.utils.print_logic_table(outputs)[source]
Print a LUT; deprecated alias of
BitLut.lut_as_str().Deprecated since version Use:
cana.function_outputs.bit_lut.BitLut.lut_as_str()instead.- Parameters:
outputs (list) – The outputs of the function.
Example
>>> print_logic_table([0,0,1,1]) 00 : 0 01 : 0 10 : 1 11 : 1
- cana.utils.function_monotone(outputs, method='exact', nsamples=100, random_seed=None)[source]
Deprecated alias of
is_function_monotone_increasing().Deprecated since version Use:
cana.function_properties.is_function_monotone_increasing()instead.method,nsamples, andrandom_seedare ignored (legacy signature).
- cana.utils.input_monotone(outputs, input_idx, activation=1)[source]
Deprecated alias of per-input positive/negative unate checks.
Deprecated since version Use:
cana.function_properties.is_input_positive_unate()orcana.function_properties.is_input_negative_unate()instead.Example
>>> input_monotone([0,1,0,0], 0, activation=1) == False >>> input_monotone([0,1,0,0], 0, activation=-1) == True