@Override
    @Beta
    public DoubleStream streamV(final int fromColumnIndex, final int toColumnIndex) {
        N.checkFromToIndex(fromColumnIndex, toColumnIndex, cols);

        if (isEmpty()) {
            return DoubleStream.empty();
        }

        return DoubleStream.of(new DoubleIteratorEx() {
            private int i = 0;
            private int j = fromColumnIndex;

            @Override
            public boolean hasNext() {
                return j < toColumnIndex;
            }

            @Override
            public double nextDouble() {
                if (j >= toColumnIndex) {
                    throw new NoSuchElementException();
                }

                final double result = a[i++][j];

                if (i >= rows) {
                    i = 0;
                    j++;
                }

                return result;
            }

            @Override
            public void skip(long n) {
                N.checkArgNotNegative(n, "n");

                if (n >= (toColumnIndex - j) * DoubleMatrix.this.rows * 1L - i) {
                    i = 0;
                    j = toColumnIndex;
                } else {
                    i += (n + i) % DoubleMatrix.this.rows;
                    j += (n + i) / DoubleMatrix.this.rows;
                }
            }

            @Override
            public long count() {
                return (toColumnIndex - j) * rows - i;
            }

            @Override
            public double[] toArray() {
                final int len = (int) count();
                final double[] c = new double[len];

                for (int k = 0; k < len; k++) {
                    c[k] = a[i++][j];

                    if (i >= rows) {
                        i = 0;
                        j++;
                    }
                }

                return c;
            }
        });
    }
@ Override @ Beta public DoubleStream streamV ( final int fromColumnIndex , final int toColumnIndex ) { N . checkFromToIndex ( fromColumnIndex , toColumnIndex , cols ) ; if ( isEmpty ( ) ) { return DoubleStream . empty ( ) ; } return DoubleStream . of ( new DoubleIteratorEx ( ) { private int i = 0 ; private int j = fromColumnIndex ; @ Override public boolean hasNext ( ) { return j < toColumnIndex ; } @ Override public double nextDouble ( ) { if ( j >= toColumnIndex ) { throw new NoSuchElementException ( ) ; } final double result = a [ i ++ ] [ j ] ; if ( i >= rows ) { i = 0 ; j ++ ; } return result ; } @ Override public void skip ( long n ) { N . checkArgNotNegative ( n , "n" ) ; if ( n >= ( toColumnIndex - j ) * DoubleMatrix . this . rows * 1L - i ) { i = 0 ; j = toColumnIndex ; } else { i += ( n + i ) % DoubleMatrix . this . rows ; j += ( n + i ) / DoubleMatrix . this . rows ; } } @ Override public long count ( ) { return ( toColumnIndex - j ) * rows - i ; } @ Override public double [ ] toArray ( ) { final int len = ( int ) count ( ) ; final double [ ] c = new double [ len ] ; for ( int k = 0 ; k < len ; k ++ ) { c [ k ] = a [ i ++ ] [ j ] ; if ( i >= rows ) { i = 0 ; j ++ ; } } return c ; } } ) ; }
@param fromColumnIndex
@param toColumnIndex
@return a stream based on the order of column.