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

◆ kuramoto_state()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::kuramoto_state ( std::span< const double >  omegas,
double  coupling,
std::span< const double >  phases = {} 
)

Builds the array kuramoto reads and writes.

Parameters
omegasNatural increment of each oscillator in radians per sample; sets the count
couplingStrength of the pull toward the group
phasesStarting phases; missing entries are 0

Layout: [N, coupling, omegas, phases].

Definition at line 486 of file Kernels.cpp.

488{
489 const size_t n = omegas.size();
490 std::vector<double> state(2 + 2 * n, 0.0);
491 state.front() = static_cast<double>(n);
492 state.at(1) = coupling;
493
494 for (size_t i = 0; i < n; ++i) {
495 state.at(2 + i) = omegas[i];
496 state.at(2 + n + i) = i < phases.size() ? phases[i] : 0.0;
497 }
498 return state;
499}