/// <summary>
        /// Constructs and returns a new <i>stride view</i> which is a sub matrix consisting of every i-th cell.
        /// More specifically, the view has Size <i>this.Count/stride</i> holding cells <i>this.Get(i*stride)</i> for all <i>i = 0..Count/stride - 1</i>.
        /// </summary>
        /// <param name="_stride">the step factor.</param>
        /// <returns>the new view.</returns>
        /// <exception cref="IndexOutOfRangeException">if <i>stride &lt;= 0</i>.</exception>
        public override DoubleMatrix1D ViewStrides(int _stride)
        {
            if (Stride <= 0)
            {
                throw new IndexOutOfRangeException(Cern.LocalizedResources.Instance().Exception_IllegalStride);
            }
            DoubleMatrix1D view = new WrapperDoubleMatrix1DStrides(this, _stride);

            view.Size = Size;
            if (Size != 0)
            {
                view.Size = (Size - 1) / _stride + 1;
            }
            return(view);
        }
Esempio n. 2
0
        /// <summary>
        /// Constructs and returns a new <i>stride view</i> which is a sub matrix consisting of every i-th cell.
        /// More specifically, the view has Size <i>this.Count/stride</i> holding cells <i>this.Get(i*stride)</i> for all <i>i = 0..Count/stride - 1</i>.
        /// </summary>
        /// <param name="_stride">the step factor.</param>
        /// <returns>the new view.</returns>
        /// <exception cref="IndexOutOfRangeException">if <i>stride &lt;= 0</i>.</exception>
        public override DoubleMatrix1D ViewStrides(int _stride)
        {
            if (Stride <= 0)
            {
                throw new IndexOutOfRangeException("illegal stride: " + Stride);
            }
            DoubleMatrix1D view = new WrapperDoubleMatrix1DStrides(this, _stride);

            view.Size = Size;
            if (Size != 0)
            {
                view.Size = (Size - 1) / _stride + 1;
            }
            return(view);
        }