Range and Slice Storage
Range<SizeType,DistanceType>
Description
The class range
specifies a range of indicies. The range is a sequence
of indices from a start value to stop value. The indices increase by one
and exlude the stop value. range
can therefore be used to specify
ranges of elements from vectors and matrices.
Example
#include <boost/numeric/ublas/storage.hpp>
int main () {
using namespace boost::numeric::ublas;
range r (0, 3);
for (unsigned i = 0; i < r.size (); ++ i) {
std::cout << r (i) << std::endl;
}
}
Definition
Defined in the header storage.hpp.
Model of
Reversible Container.
Type requirements
None, except for those imposed by the requirements of Reversible Container.
Public base classes
None.
Members
Member | Description |
---|---|
|
Constructs a range of
indicies from |
|
Returns the beginning of the |
|
Returns the size of the |
|
Returns the value
|
|
Returns the composite range
from |
|
Tests two ranges for equality. |
|
Tests two ranges for inequality. |
|
Returns a |
|
Returns a |
|
Returns a
|
|
Returns a
|
Preconditions
-
start () < = stop ()
Slice<SizeType,DistanceType>
Description
The class slice
specifies a 'slice' of indicies. Slices are more
general then ranges, the stride allows the sequence of indicies to
increase and decrease by the specified amount between element. slice
can therefore be used to specify slices of element from vectors and
matrices.
Example
#include <boost/numeric/ublas/storage.hpp>
int main () {
using namespace boost::numeric::ublas;
slice s (0, 1, 3);
for (unsigned i = 0; i < s.size (); ++ i) {
std::cout << s (i) << std::endl;
}
}
Definition
Defined in the header storage.hpp.
Model of
Reversible Container.
Type requirements
None, except for those imposed by the requirements of Reversible Container.
Public base classes
None.
Members
Member | Description |
---|---|
|
Constructs
a slice |
|
Returns the beginning of the |
|
Returns the stride of the |
|
Returns the size of the |
|
Returns the value
|
|
Returns the composite slice
from |
|
Returns the composite slice
from |
|
Tests two slices for equality. |
|
Tests two slices for inequality. |
|
Returns a |
|
Returns a |
|
Returns a
|
|
Returns a
|
Preconditions
-
None all strides are vaild. However when an index is returned or an iterator is dereferenced its value must be representable as the size_type.
Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, Joerg Walter,
Gunter Winkler
Copyright (©) 2021 Shikhar Vashistha
Use, modification and distribution are subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt ).