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

◆ state_machine_state()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::state_machine_state ( std::span< const double >  table,
double  threshold = 0.5,
size_t  initial = 0 
)

Builds the array state_machine reads and writes.

Parameters
tablePer state, four entries: next state and output when the input bit is 0, then next state and output when it is 1
thresholdLevel that makes the input bit 1
initialStarting state

Layout: [threshold, states, state, table...]. The state count is the table length over four.

Definition at line 169 of file Boolean.cpp.

170{
171 const size_t states = table.size() / 4;
172
173 std::vector<double> state(3 + 4 * states, 0.0);
174 state[0] = threshold;
175 state[1] = static_cast<double>(states);
176 state[2] = static_cast<double>(initial);
177
178 std::copy_n(table.begin(), static_cast<std::ptrdiff_t>(4 * states), state.begin() + 3);
179 return state;
180}
float threshold

References threshold.