コード例 #1
0
ファイル: Convolution1D.cs プロジェクト: basp/pixlr
        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));
        }
コード例 #2
0
ファイル: Convolution1D.cs プロジェクト: basp/pixlr
        public Vector <U> Same(Vector <U> u)
        {
            var strat = new ConvolutionStrategy1D
            {
                FromInclusive = 0,
                ToExclusive   = u.Length,
                TargetLength  = u.Length,
            };

            return(this.Convolve(u, strat));
        }
コード例 #3
0
ファイル: Convolution1D.cs プロジェクト: basp/pixlr
        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);
        }