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

◆ input_truth_table_state()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::input_truth_table_state ( size_t  arity,
uint64_t  rule,
double  threshold = 0.5 
)

Builds the array input_truth_table reads.

Parameters
arityNumber of input slots, at most 6
ruleOutput for each pattern; bit i is the output when the pattern, slot 0 as the lowest bit, equals i
thresholdLevel that makes a slot a one

Layout: [threshold, arity, outputs...].

Definition at line 310 of file Boolean.cpp.

311{
312 arity = std::min(arity, MAX_STATE_ARITY);
313
314 std::vector<double> state(2 + (size_t { 1 } << arity), 0.0);
315 state[0] = threshold;
316 state[1] = static_cast<double>(arity);
317
318 for (size_t i = 2; i < state.size(); ++i)
319 state[i] = static_cast<double>((rule >> (i - 2)) & 1U);
320 return state;
321}
float threshold

References threshold.