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

◆ dominant_cell()

template<typename LatticeT , typename CellT >
std::pair< CellT, size_t > MayaFlux::Kinesis::SymbolicTrajectory< LatticeT, CellT >::dominant_cell ( size_t  window) const
inline

Cell with the most observations within the most recent window observations.

Parameters
windowNumber of recent observations to examine, clamped to the trajectory's retained history capacity
Returns
The most-occupied cell in the window, and how many of the window's observations fell in it

Ties resolve to whichever qualifying cell appears first in the scan, which is the most recent one among ties since the underlying HistoryBuffer is newest-first; not documented as a guarantee beyond "deterministic," since which specific tie-break rule matters is a caller decision this does not presume to make.

Definition at line 196 of file SymbolicTrajectory.hpp.

197 {
198 window = std::min(window, m_history.capacity());
199 const auto view = m_history.linearized_view();
200
201 CellT best {};
202 size_t best_count = 0;
203 for (size_t i = 0; i < window; ++i) {
204 size_t count = 0;
205 for (size_t j = 0; j < window; ++j) {
206 if (view[j] == view[i])
207 ++count;
208 }
209 if (count > best_count) {
210 best_count = count;
211 best = view[i];
212 }
213 }
214 return { best, best_count };
215 }
std::weak_ptr< Core::Window > window
Definition Picker.cpp:23
size_t count
Memory::HistoryBuffer< CellT > m_history
std::span< T > linearized_view()
Get mutable linearized view of entire history.
size_t capacity() const
Get buffer capacity.

References MayaFlux::Memory::HistoryBuffer< T >::capacity(), count, MayaFlux::Memory::HistoryBuffer< T >::linearized_view(), MayaFlux::Kinesis::SymbolicTrajectory< LatticeT, CellT >::m_history, and window.

+ Here is the call graph for this function: