Ad
  • Custom User Avatar

    I'm glad you already got it, because now I'm thoroughly confused.

  • Custom User Avatar

    Thank you @RileyHunter

  • Custom User Avatar

    I meant what mathematical dissertation/application that would represent:

    • Signal Processing: Moving average calculations
    • Time Series Analysis: Rolling statistics
    • Pattern Recognition: Feature extraction from sequences
    • Convolution Operations: Discrete convolution with a sliding kernel
    • String Matching: Finding patterns in sequences

    L = [a₀, a₁, a₂, ..., aₙ₋₁]

    Now I got it and solved it.

  • Custom User Avatar

    @Spaceman perhaps a different analogy would help - think of the boundaries of the window as existing "between" the indices of the array elements. So for the array

    [0, 1, 2]
    

    we have valid boundaries like so:

    [* 0 * 1 * 2 *]
    

    Then, to construct a window of a given length we place our left boundary, move forward length steps and place the right boundary. To construct the next window we move the left boundary forward by offset.

    So for length = 2, offset = 1 we do:

    [{ 0 * 1 } 2 *]
    [* 0 { 1 * 2 }]
    

    and for length = 1 we do:

    [{ 0 } 1 * 2 *]
    [* 0 { 1 } 2 *]
    [* 0 * 1 { 2 }]
    

    and it then follows that for the empty window, we do:

    [{} 0 * 1 * 2 *]
    [* 0 {} 1 * 2 *]
    [* 0 * 1 {} 2 *]
    [* 0 * 1 * 2 {}]
    

    Even when the set of remaining indices is empty, the empty set is still a valid subset because the empty set is a subset of all sets (including itself).

  • Custom User Avatar

    I don't understand what you're asking.

  • Custom User Avatar

    That's a weird set of thought. Mathematically, what is this equivalent to?

  • Custom User Avatar

    You are putting the window on [2,3], then on [3], then on [] ( because offset 1 ).

    So no. Because you can take 0 elements from an empty list.

    Encoding the list as a cons-list maybe makes this easier to visualise: in a list of length 2, there are 3 constructors ( Cons 2 (Cons 3 Nil) ). An array doesn't have constructors, it's just mapped memory, but even then there's one more value: maybe its length, maybe a trailing NUL, or something.