MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ truth_table_state()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::truth_table_state ( size_t  arity,
uint64_t  rule 
)

Builds the array truth_table reads.

Parameters
arityNumber of history bits, at most 6
ruleOutput for each input pattern; bit i is the output when the pattern, with history[0] as the lowest bit, equals i

Layout: [arity, outputs...], 2^arity outputs of 0 or 1. For larger arities write the array directly.

Definition at line 33 of file Boolean.cpp.

34{
35 arity = std::min(arity, MAX_STATE_ARITY);
36
37 std::vector<double> state(1 + (size_t { 1 } << arity), 0.0);
38 state.front() = static_cast<double>(arity);
39
40 for (size_t i = 1; i < state.size(); ++i)
41 state[i] = static_cast<double>((rule >> (i - 1)) & 1U);
42 return state;
43}