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

◆ crossings_in_window()

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

Crossings within the most recent window observations.

Parameters
windowNumber of recent observations to examine, clamped to the trajectory's retained history capacity
Returns
Count of adjacent-pair differences within the window

Distinct from crossing_count(): this only looks at the retained window, so it answers "how much boundary-crossing has happened recently" rather than "how much has happened ever."

Definition at line 116 of file SymbolicTrajectory.hpp.

117 {
118 window = std::min(window, m_history.capacity());
119 if (window < 2)
120 return 0;
121
122 const auto view = m_history.linearized_view();
123 size_t crossings = 0;
124 for (size_t i = 0; i + 1 < window; ++i) {
125 if (!(view[i] == view[i + 1]))
126 ++crossings;
127 }
128 return crossings;
129 }
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(), MayaFlux::Memory::HistoryBuffer< T >::linearized_view(), and MayaFlux::Kinesis::SymbolicTrajectory< LatticeT, CellT >::m_history.

+ Here is the call graph for this function: