Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

gslice


Valarray helpers

Summary

A numeric array class used to represent a generalized slice from an array.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <valarray>
class gslice ;

Description

gslice represents a generalized slice from an array. A generalized slice contains a starting index, a set of lengths and a set of strides. The number of lengths and strides must be equal. Together the lengths and strides allow a slice from a multiple dimension array (with the dimension equal to the number of strides) to be represented on a one dimensional valarray. The gslice maps a set of n indices (ij), where n is equal to the number of strides, to a single index k.

When applied to a valarray using the gslice subscript operator (see valarray) a gslice produces a gslice_array. The gslice_array class creates a view into the original valarray that is tailored to match parameters of the gslice. The elements in a gslice_array are references to the elements in the original array.

Interface

class gslice {
public:
  // constructors
  gslice();
  gslice(size_t, const valarray<size_t>&, 
         const valarray<size_t>&);
  gslice (const gslice&);

  // Accessors
  size_t start() const;
  valarray<size_t> size() const;
  valarray<size_t> stride() const;
};

Constructors

gslice();
gslice(size_t start, const valarray<size_t>& length,
       const valarray<size_t>& stride);
gslice(const gslice&)

Accessors

size_t start();
valarraysize_t> size();
Valarray<size_t> stride();

Example

Program Output

Warnings

If your compiler does not support namespaces, then you do not need the using declaration for std.

See Also

valarray, slice_array, slice, gslice_array, mask_array, indirect_array



Previous fileTop of documentContentsIndexNext file
©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998