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

◆ rotor_bank_state()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::rotor_bank_state ( std::span< const double >  increments,
std::span< const double >  scales = {},
std::span< const double >  phases = {} 
)

Builds the array rotor_bank reads and writes.

Parameters
incrementsRadians per sample of each sinusoid; sets the count
scalesAmplitude of each; missing entries are 1
phasesStarting phase of each; missing entries are 0

Layout: [N, cos(increment), sin(increment), scales, re, im], each column N long. The rotation is precomputed here, so a call needs no sine.

Definition at line 199 of file Kernels.cpp.

203{
204 const size_t n = increments.size();
205 std::vector<double> state(1 + 5 * n, 0.0);
206 state.front() = static_cast<double>(n);
207
208 for (size_t i = 0; i < n; ++i) {
209 const double phase = i < phases.size() ? phases[i] : 0.0;
210 state.at(1 + i) = std::cos(increments[i]);
211 state.at(1 + n + i) = std::sin(increments[i]);
212 state.at(1 + 2 * n + i) = i < scales.size() ? scales[i] : 1.0;
213 state.at(1 + 3 * n + i) = std::cos(phase);
214 state.at(1 + 4 * n + i) = std::sin(phase);
215 }
216 return state;
217}