JeffreySarnoff / RollingFunctions.jl

Roll a window over data; apply a function over the window.
MIT License
114 stars 6 forks source link

Typo in type checking of 4th vector #44

Closed alancummings closed 1 year ago

alancummings commented 1 year ago

I think the second "T3" must be a typo in the 4 vector version of functions (in src/roll/roll.jl)

One example:

function basic_rolling(window_fn::Function, data1::AbstractVector{T1}, data2::AbstractVector{T2}, data3::AbstractVector{T3}, data4::AbstractVector{T4},
    window_span::Int) where {T1,T2,T3,T4}
    typ = promote_type(T1, T2, T3, T4)
    ᵛʷdata1 = typ == T1 ? asview(data1) : asview(map(typ, data1))
    ᵛʷdata2 = typ == T2 ? asview(data2) : asview(map(typ, data2))
    ᵛʷdata3 = typ == T3 ? asview(data3) : asview(map(typ, data3))
    ᵛʷdata4 = typ == T3 ? asview(data4) : asview(map(typ, data4))

    basic_rolling(window_fn, ᵛʷdata1, ᵛʷdata2, ᵛʷdata3, ᵛʷdata4, window_span)
end

ᵛʷdata4 = typ == T3 ? asview(data4) : asview(map(typ, data4)) should probably be ᵛʷdata4 = typ == T4 ? asview(data4) : asview(map(typ, data4))

JeffreySarnoff commented 1 year ago

thank you. fixed.