public Vector <U> All(Vector <U> u) { var strat = new ConvolutionStrategy1D { FromInclusive = -this.vc, ToExclusive = u.Length + this.vc, TargetLength = u.Length + 2 * this.vc, }; return(this.Convolve(u, strat)); }
public Vector <U> Same(Vector <U> u) { var strat = new ConvolutionStrategy1D { FromInclusive = 0, ToExclusive = u.Length, TargetLength = u.Length, }; return(this.Convolve(u, strat)); }
internal Vector <U> Convolve(Vector <U> u, ConvolutionStrategy1D strat) { var w = Vector.Build <U>().Dense(strat.TargetLength, _ => default(U)); Parallel.For(strat.FromInclusive, strat.ToExclusive, i => { var s = this.Accumulate(i, u); w[i - strat.FromInclusive] = s; }); return(w); }