From 433433f07149bdef70d654113cf3ff3937c8dc22 Mon Sep 17 00:00:00 2001 From: Toon Knapen Date: Sat, 15 Jan 2005 19:07:49 +0000 Subject: [PATCH] merged from uBLAS-cvs [SVN r26707] --- doc/bounded_array.htm | 206 ++++++ doc/container_concept.htm | 397 +++++++++++ doc/dense_matrix_concept.htm | 397 +++++++++++ doc/dense_vector_concept.htm | 218 ++++++ doc/dense_vector_concept.htm~ | 224 +++++++ doc/expression_concept.htm | 1027 ++++++++++++++++++++++++++++ doc/iterator_concept.htm | 1182 +++++++++++++++++++++++++++++++++ doc/range.htm | 210 ++++++ doc/storage_concept.htm | 139 ++++ doc/tidy.htm | 758 +++++++++++++++++++++ doc/unbounded_array.htm | 206 ++++++ doc/vector.html | 0 12 files changed, 4964 insertions(+) create mode 100644 doc/bounded_array.htm create mode 100644 doc/container_concept.htm create mode 100644 doc/dense_matrix_concept.htm create mode 100644 doc/dense_vector_concept.htm create mode 100644 doc/dense_vector_concept.htm~ create mode 100644 doc/expression_concept.htm create mode 100644 doc/iterator_concept.htm create mode 100644 doc/range.htm create mode 100644 doc/storage_concept.htm create mode 100644 doc/tidy.htm create mode 100644 doc/unbounded_array.htm create mode 100644 doc/vector.html diff --git a/doc/bounded_array.htm b/doc/bounded_array.htm new file mode 100644 index 00000000..48e53749 --- /dev/null +++ b/doc/bounded_array.htm @@ -0,0 +1,206 @@ + + + + + +Bounded Array; + + +

c++boost.gif +Bounded Array Storage

+

Bounded Array<T,N,Alloc>

+

Description

+

The templated class bounded_array<T, N, ALLOC> implements a bounded storage array. The bounded array is similar to a C++ array type in that its maximum size is bounded by N and is allocated on the stack instead of the heap. Similarly a bounded_array requires no secondary storage and ALLOC is only used to specifysize_type and difference_type. +

+

When resized bounded_array uses the same storage with the same bound!. It is therefore efficient to resize a bounded_array

+

Example

+
+#include <boost/numeric/ublas/storage.hpp>
+
+int main () {
+    using namespace boost::numeric::ublas;
+    bounded_array<double, 3> a (3);
+    for (unsigned i = 0; i < a.size (); ++ i) {
+        a [i] = i;
+        std::cout << a [i] << std::endl;
+    }
+}
+
+

Definition

+

Defined in the header storage.hpp.

+

Template parameters

+ + + + + + + + + + + + + + + + + + + + + + + +
ParameterDescriptionDefault
TThe type of object stored in the array.
NThe allocation size of the array.
ALLOCAn STL Allocatorstd::allocator
+

Model of

+

Random Access Container.

+

Type requirements

+

None, except for those imposed by the requirements of Random Access Container.

+

Public base classes

+

None.

+

Members

+Editor's notes: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MemberWhere definedDescription
value_typeContainer
pointerContainerCurrently defined as value_type*
const_pointerCurrently defined as value_type*
referenceContainerCurrently defined as value_type&
const_referenceContainerCurrently defined as const value_type&
size_typeContainerCurrently defined as Alloc::size_type
difference_typeContainerCurrently defined as Alloc::difference_type
iteratorContainerCurrently defined as pointer
const_iteratorContainerCurrently defined as const_pointer
revere_iteratorContainerCurrently defined as std::reverse_iterator<iterator>
const_revere_iteratorContainerCurrently defined as std::reverse_iterator<const_iterator>
bounded_array ()Creates a bounded_array that holds at most ZERO elements.
explicit bounded_array (size_type size, const T& = init)Storage +Creates an initialized bounded_array that holds at most size elements. All the elements are constructed from the init value.
bounded_array (size_type size)Storage +Creates an uninitialized bounded_array that holds at most size elements. All the elements are default constructed.
bounded_array (size_type size, const T& init)Storage +Creates an bounded_array that holds at most size elements. All the elements are copy-constructed from init.
bounded_array (const bounded_array &c)ContainerThe copy constructor.
~bounded_array ()ContainerDeallocates the bounded_array itself.
void resize (size_type size)Storage +Reallocates a bounded_array to hold at most size elements.
void resize (size_type size, const T& t)Storage +Reallocates a bounded_array to hold at most size elements.
size_type size () constContainerReturns the size of the bounded_array.
const_reference operator [] (size_type i) constContainerReturns a const reference of the i -th element.
reference operator [] (size_type i)ContainerReturns a reference of the i-th element.
bounded_array &operator = (const bounded_array &a)ContainerThe assignment operator.
bounded_array &assign_temporary (bounded_array &a)Assigns a temporary. May change the array a.
void swap (bounded_array &a)ContainerSwaps the contents of the arrays.
const_iterator begin () constContainerReturns a const_iterator pointing to the beginning of the bounded_array.
const_iterator end () constContainerReturns a const_iterator pointing to the end of the bounded_array.
iterator begin ()ContainerReturns a iterator pointing to the beginning of the bounded_array.
iterator end ()ContainerReturns a iterator pointing to the end of the bounded_array.
const_reverse_iterator rbegin () constReversible ContainerReturns a const_reverse_iterator pointing to the beginning of the reversed bounded_array.
const_reverse_iterator rend () constReversible ContainerReturns a const_reverse_iterator pointing to the end of the reversed bounded_array.
reverse_iterator rbegin ()Reversible ContainerReturns a reverse_iterator pointing to the beginning of the reversed bounded_array.
reverse_iterator rend ()Reversible ContainerReturns a reverse_iterator pointing to the end of the reversed bounded_array.
+ + diff --git a/doc/container_concept.htm b/doc/container_concept.htm new file mode 100644 index 00000000..30d41b6e --- /dev/null +++ b/doc/container_concept.htm @@ -0,0 +1,397 @@ + + + + + + +Container Concepts + + +

c++boost.gif +Container Concepts

+

Vector

+

Description

+

A Vector describes common aspects of dense, packed and sparse +vectors.

+

Refinement of

+

Vector Expression +.

+

Associated types

+

+In addition to the types defined int + Vector Expression +

+ + + + + + + + +
Storagearray_typeThe type of underlying storage used to store the elements
+

Notation

+ + + + + + + + + + + + + + + + + + + + + + + +
VA type that is a model of Vector
vObjects of type V
n, iObjects of a type convertible to size_type
tObject of a type convertible to value_type
pObject of a type convertible to bool
+

Definitions

+

Valid expressions

+

In addition to the expressions defined in Vector Expression the +following expressions must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Sizing constructorV v (n) V
Element access [1]v[n]n is convertible to size_typereference if v is mutable, const_reference otherwise
Insertv.insert_element (i, t)v is mutable.void
Erasev.erase_element (i)v is mutable.void
Clearv.clear ()v is mutable.void
Resizev.resize (n)
+v.resize (n, p)
v is mutable.void
Storagedata() constconst array_type&
Storagedata()v is mutablearray_type&
+

Expression semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in Vector Expression .

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Sizing constructorV v (n)n >= 0Allocates a vector ofn elements.v.size () == n.
Element access [1]v[n]0<n>v.size()returns the n-th element in v
Insertv.insert_element (i, t)0 <= i < v.size () and
+v (i) is equal to value_type (0).
A copy of t is inserted in v.v (i) is a copy of t.
Erasev.erase_element (i)0 <= i < v.size ()Destroys the element v (i) and replaces it with +value_type ().v (i) is a copy of value_type +().
Clearv.clear () Equivalent to
+for (i = 0; i < v.size (); ++ i)
v.erase (i);
 
Resizev.resize (n) +
v.resize (n, p)
 Reallocates the vector so that it can hold n +elements.
+Erases or appends elements in order to bring the vector to the prescribed size. Appended elements copies of value_type(). +
+When p == false then existing elements are not preserved and elements will not appended as normal. Instead the vector is in the same state as that after an equivalent sizing constructor.
v.size () == n.
Storagev.data()v is constReturns a reference to the underlying storage
Storagev.data()v is mutableReturns a reference to the underlying storage
+

Complexity guarantees

+

The run-time complexity of the sizing constructor is linear in +the vector's size.

+

The run-time complexity of insert_element and erase_element is specific for the +vector.

+

The run-time complexity of resize is linear in the vector's +size.

+

Invariants

+

Models

+ +

Notes

+[1]The operator[] is added purely for convenience +and compatibility with the std::vector. In uBLAS however, +generally operator() is used for indexing because this can be +used for both vectors and matrices. +

Matrix

+

Description

+

A Matrix describes common aspects of dense, packed and sparse +matrices.

+

Refinement of

+

Matrix Expression +.

+

Associated types

+

+See Matrix Expression +

+

Notation

+ + + + + + + + + + + + + + + + + + + + + + + +
MA type that is a model of Matrix
mObjects of type M
n1, n2, i, jObjects of a type convertible to size_type
tObject of a type convertible to value_type
pObject of a type convertible to bool
+

Definitions

+

Valid expressions

+

In addition to the expressions defined in Matrix Expression the +following expressions must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Sizing constructorM m (n1, n2) M
Insertm.insert_element (i, j, t)m is mutable.void
Erasem.erase_element (i, j)m is mutable.void
Clearm.clear ()m is mutable.void
Resizem.resize (n1, n2)
+m.resize (n1, n2, p)
m is mutable.void
+

Expression semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in Matrix Expression .

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Sizing constructorM m (n1, n2)n1 >= 0 and n2 >= 0Allocates a matrix of n1 rows and n2 +columns.m.size1 () == n1 and m.size2 () == +n2.
Insertm.insert_element (i, j, t)0 <= i < m.size1 (),
+0 <= j < m.size2 ()and
+m (i, j)
is equal to value_type (0).
A copy of t is inserted in m.m (i, j) is a copy of t.
Erasem.erase (i, j)0 <= i < m.size1 ()and
+0 <= j < m.size2
Destroys the element m (i, j) and replaces it with +value_type ().m (i, j) is a copy of value_type +().
Clearm.clear () Equivalent to
+for (i = 0; i < m.size1 (); ++ i)
for (j = 0; j < m.size2 (); ++ j)
+    m.erase (i, j);
 
Resizem.resize (n1, n2) +
+m.resize (n1, n2, p) +
 Reallocate the matrix so that it can hold n1 rows +and n2 columns.
+Erases or appends elements in order to bring the matrix to the +prescribed size. Appended elements are value_type() +copies.
+When p == false then existing elements are not preserved and elements will not appended as normal. Instead the matrix is in the same state as that after an equivalent sizing constructor.
m.size1 () == n1 and m.size2 () == n2.
+

Complexity guarantees

+

The run-time complexity of the sizing constructor is quadratic +in the matrix's size.

+

The run-time complexity of insert_element and erase_element is specific for the +matrix.

+

The run-time complexity of resize is quadratic in the matrix's +size.

+

Invariants

+

Models

+ +
+

Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
+Permission to copy, use, modify, sell and distribute this document +is granted provided this copyright notice appears in all copies. +This document is provided ``as is'' without express or implied +warranty, and with no claim as to its suitability for any +purpose.

+

Last revised: 24/06/2004

+ + diff --git a/doc/dense_matrix_concept.htm b/doc/dense_matrix_concept.htm new file mode 100644 index 00000000..30d41b6e --- /dev/null +++ b/doc/dense_matrix_concept.htm @@ -0,0 +1,397 @@ + + + + + + +Container Concepts + + +

c++boost.gif +Container Concepts

+

Vector

+

Description

+

A Vector describes common aspects of dense, packed and sparse +vectors.

+

Refinement of

+

Vector Expression +.

+

Associated types

+

+In addition to the types defined int + Vector Expression +

+ + + + + + + + +
Storagearray_typeThe type of underlying storage used to store the elements
+

Notation

+ + + + + + + + + + + + + + + + + + + + + + + +
VA type that is a model of Vector
vObjects of type V
n, iObjects of a type convertible to size_type
tObject of a type convertible to value_type
pObject of a type convertible to bool
+

Definitions

+

Valid expressions

+

In addition to the expressions defined in Vector Expression the +following expressions must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Sizing constructorV v (n) V
Element access [1]v[n]n is convertible to size_typereference if v is mutable, const_reference otherwise
Insertv.insert_element (i, t)v is mutable.void
Erasev.erase_element (i)v is mutable.void
Clearv.clear ()v is mutable.void
Resizev.resize (n)
+v.resize (n, p)
v is mutable.void
Storagedata() constconst array_type&
Storagedata()v is mutablearray_type&
+

Expression semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in Vector Expression .

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Sizing constructorV v (n)n >= 0Allocates a vector ofn elements.v.size () == n.
Element access [1]v[n]0<n>v.size()returns the n-th element in v
Insertv.insert_element (i, t)0 <= i < v.size () and
+v (i) is equal to value_type (0).
A copy of t is inserted in v.v (i) is a copy of t.
Erasev.erase_element (i)0 <= i < v.size ()Destroys the element v (i) and replaces it with +value_type ().v (i) is a copy of value_type +().
Clearv.clear () Equivalent to
+for (i = 0; i < v.size (); ++ i)
v.erase (i);
 
Resizev.resize (n) +
v.resize (n, p)
 Reallocates the vector so that it can hold n +elements.
+Erases or appends elements in order to bring the vector to the prescribed size. Appended elements copies of value_type(). +
+When p == false then existing elements are not preserved and elements will not appended as normal. Instead the vector is in the same state as that after an equivalent sizing constructor.
v.size () == n.
Storagev.data()v is constReturns a reference to the underlying storage
Storagev.data()v is mutableReturns a reference to the underlying storage
+

Complexity guarantees

+

The run-time complexity of the sizing constructor is linear in +the vector's size.

+

The run-time complexity of insert_element and erase_element is specific for the +vector.

+

The run-time complexity of resize is linear in the vector's +size.

+

Invariants

+

Models

+ +

Notes

+[1]The operator[] is added purely for convenience +and compatibility with the std::vector. In uBLAS however, +generally operator() is used for indexing because this can be +used for both vectors and matrices. +

Matrix

+

Description

+

A Matrix describes common aspects of dense, packed and sparse +matrices.

+

Refinement of

+

Matrix Expression +.

+

Associated types

+

+See Matrix Expression +

+

Notation

+ + + + + + + + + + + + + + + + + + + + + + + +
MA type that is a model of Matrix
mObjects of type M
n1, n2, i, jObjects of a type convertible to size_type
tObject of a type convertible to value_type
pObject of a type convertible to bool
+

Definitions

+

Valid expressions

+

In addition to the expressions defined in Matrix Expression the +following expressions must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Sizing constructorM m (n1, n2) M
Insertm.insert_element (i, j, t)m is mutable.void
Erasem.erase_element (i, j)m is mutable.void
Clearm.clear ()m is mutable.void
Resizem.resize (n1, n2)
+m.resize (n1, n2, p)
m is mutable.void
+

Expression semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in Matrix Expression .

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Sizing constructorM m (n1, n2)n1 >= 0 and n2 >= 0Allocates a matrix of n1 rows and n2 +columns.m.size1 () == n1 and m.size2 () == +n2.
Insertm.insert_element (i, j, t)0 <= i < m.size1 (),
+0 <= j < m.size2 ()and
+m (i, j)
is equal to value_type (0).
A copy of t is inserted in m.m (i, j) is a copy of t.
Erasem.erase (i, j)0 <= i < m.size1 ()and
+0 <= j < m.size2
Destroys the element m (i, j) and replaces it with +value_type ().m (i, j) is a copy of value_type +().
Clearm.clear () Equivalent to
+for (i = 0; i < m.size1 (); ++ i)
for (j = 0; j < m.size2 (); ++ j)
+    m.erase (i, j);
 
Resizem.resize (n1, n2) +
+m.resize (n1, n2, p) +
 Reallocate the matrix so that it can hold n1 rows +and n2 columns.
+Erases or appends elements in order to bring the matrix to the +prescribed size. Appended elements are value_type() +copies.
+When p == false then existing elements are not preserved and elements will not appended as normal. Instead the matrix is in the same state as that after an equivalent sizing constructor.
m.size1 () == n1 and m.size2 () == n2.
+

Complexity guarantees

+

The run-time complexity of the sizing constructor is quadratic +in the matrix's size.

+

The run-time complexity of insert_element and erase_element is specific for the +matrix.

+

The run-time complexity of resize is quadratic in the matrix's +size.

+

Invariants

+

Models

+ +
+

Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
+Permission to copy, use, modify, sell and distribute this document +is granted provided this copyright notice appears in all copies. +This document is provided ``as is'' without express or implied +warranty, and with no claim as to its suitability for any +purpose.

+

Last revised: 24/06/2004

+ + diff --git a/doc/dense_vector_concept.htm b/doc/dense_vector_concept.htm new file mode 100644 index 00000000..f2534667 --- /dev/null +++ b/doc/dense_vector_concept.htm @@ -0,0 +1,218 @@ + + + + + + +DenseVector Concept + + +

c++boost.gif +DenseVector Concept

+

DenseVector

+

Description

+

A dense-vector is a, exactly as the name says, a dense vector that is intended to behave well for linear algebra operations

+

Refinement of

+

DefaultConstructible, RandomAccessContainer and Vector Expression[1].

+

Associated types

+

In addition to the types defined by RandomAccessContainer and Vector Expression

+ + + + + + + + +
StorageArrayarray_typeThe type of underlying storage used to store the elements
+

Notation

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
VA type that is a model of Vector
TThe value_type of elements of V
vObjects of type V
n, iObjects of a type convertible to size_type
tObject of a type convertible to T
pObject of a type convertible to bool
+

Definitions

+

Valid expressions

+

In addition to the expressions defined in DefaultConstructible and Vector Expression the following expressions must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Size-constructorV v(n)T is DefaultConstructibleV
Insertv.insert_element (i, t)v is mutable.void
Erasev.erase_element (i)v is mutable.void
Clearv.clear ()v is mutable.void
Resizev.resize (n)
+v.resize (n, p)
v is mutable.void
Storagedata() constconst array_type&
Storagedata()v is mutablearray_type&
+

Expression semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in Vector Expression .

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Sizing constructorV v (n)n >= 0Allocates a vector ofn elements.v.size () == n.
Element access [1]v[n]0<n>v.size()returns the n-th element in v
Insertv.insert_element (i, t)0 <= i < v.size () and
+v (i) is equal to value_type (0).
A copy of t is inserted in v.v (i) is a copy of t.
Erasev.erase_element (i)0 <= i < v.size ()Destroys the element v (i) and replaces it with +value_type ().v (i) is a copy of value_type +().
Clearv.clear () Equivalent to
+for (i = 0; i < v.size (); ++ i)
v.erase (i);
 
Resizev.resize (n) +
v.resize (n, p)
 Reallocates the vector so that it can hold n +elements.
+Erases or appends elements in order to bring the vector to the prescribed size. Appended elements copies of value_type(). +
+When p == false then existing elements are not preserved and elements will not appended as normal. Instead the vector is in the same state as that after an equivalent sizing constructor.
v.size () == n.
Storagev.data()v is constReturns a reference to the underlying storage
Storagev.data()v is mutableReturns a reference to the underlying storage
+

Complexity guarantees

+

The run-time complexity of the sizing constructor is linear in +the vector's size.

+

The run-time complexity of insert_element and erase_element is specific for the +vector.

+

The run-time complexity of resize is linear in the vector's +size.

+

Invariants

+

Models

+ +

Notes

+

[1] +As a user you should not care about DenseVector being a refinement of the VectorExpression. Being a refinement of the VectorExpression is only important for the template-expression engine but not the user. +[1]The operator[] is added purely for convenience +and compatibility with the std::vector. In uBLAS however, +generally operator() is used for indexing because this can be +used for both vectors and matrices. + + diff --git a/doc/dense_vector_concept.htm~ b/doc/dense_vector_concept.htm~ new file mode 100644 index 00000000..3597bf32 --- /dev/null +++ b/doc/dense_vector_concept.htm~ @@ -0,0 +1,224 @@ + + + + + + +DenseVector Concept + + +

c++boost.gif +DenseVector Concept

+

DenseVector

+

Description

+

A dense-vector is a, exactly as the name says, a dense vector that is intended to behave well for linear algebra operations

+

Refinement of

+

Vector Expression[1].

+

Associated types

+

+In addition to the types defined int + Vector Expression +

+ + + + + + + + +
Storagearray_typeThe type of underlying storage used to store the elements
+

Notation

+ + + + + + + + + + + + + + + + + + + + + + + +
VA type that is a model of Vector
vObjects of type V
n, iObjects of a type convertible to size_type
tObject of a type convertible to value_type
pObject of a type convertible to bool
+

Definitions

+

Valid expressions

+

In addition to the expressions defined in Vector Expression the +following expressions must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Sizing constructorV v (n) V
Element access [1]v[n]n is convertible to size_typereference if v is mutable, const_reference otherwise
Insertv.insert_element (i, t)v is mutable.void
Erasev.erase_element (i)v is mutable.void
Clearv.clear ()v is mutable.void
Resizev.resize (n)
+v.resize (n, p)
v is mutable.void
Storagedata() constconst array_type&
Storagedata()v is mutablearray_type&
+

Expression semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in Vector Expression .

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Sizing constructorV v (n)n >= 0Allocates a vector ofn elements.v.size () == n.
Element access [1]v[n]0<n>v.size()returns the n-th element in v
Insertv.insert_element (i, t)0 <= i < v.size () and
+v (i) is equal to value_type (0).
A copy of t is inserted in v.v (i) is a copy of t.
Erasev.erase_element (i)0 <= i < v.size ()Destroys the element v (i) and replaces it with +value_type ().v (i) is a copy of value_type +().
Clearv.clear () Equivalent to
+for (i = 0; i < v.size (); ++ i)
v.erase (i);
 
Resizev.resize (n) +
v.resize (n, p)
 Reallocates the vector so that it can hold n +elements.
+Erases or appends elements in order to bring the vector to the prescribed size. Appended elements copies of value_type(). +
+When p == false then existing elements are not preserved and elements will not appended as normal. Instead the vector is in the same state as that after an equivalent sizing constructor.
v.size () == n.
Storagev.data()v is constReturns a reference to the underlying storage
Storagev.data()v is mutableReturns a reference to the underlying storage
+

Complexity guarantees

+

The run-time complexity of the sizing constructor is linear in +the vector's size.

+

The run-time complexity of insert_element and erase_element is specific for the +vector.

+

The run-time complexity of resize is linear in the vector's +size.

+

Invariants

+

Models

+ +

Notes

+

[1] +As a user you should not care about DenseVector being a refinement of the VectorExpression. Being a refinement of the VectorExpression is only important for the template-expression engine but not the user. +[1]The operator[] is added purely for convenience +and compatibility with the std::vector. In uBLAS however, +generally operator() is used for indexing because this can be +used for both vectors and matrices. + + diff --git a/doc/expression_concept.htm b/doc/expression_concept.htm new file mode 100644 index 00000000..a38e6f73 --- /dev/null +++ b/doc/expression_concept.htm @@ -0,0 +1,1027 @@ + + + + + +Expression Concepts + + +

c++boost.gif +Expression Concepts

+

Scalar +Expression

+

Description

+

A Scalar Expression is an expression convertible to a scalar +type.

+

Refinement of

+

Default Constructible.

+

Associated types

+ + + + + + + + +
Value typevalue_typeThe type of the scalar expression.
+

Notation

+ + + + + + + +
SA type that is a model of Scalar Expression
+

Definitions

+

Valid expressions

+

In addition to the expressions defined in Default Constructible +the following expressions must be valid.

+ + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Evaluationoperator value_type () const value_type
+

Expression semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in Default Constructible.

+ + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Evaluationoperator value_type () const   Evaluates the scalar expression. 
+

Complexity guarantees

+

The run-time complexity of the evaluation is specific for the +evaluated scalar expression.

+

Invariants

+

Models

+ +

Vector +Expression

+

Description

+

A Vector Expression is an expression evaluatable to a vector. +Vector Expression provides an Indexed Bidirectional +Iterator or an Indexed Random Access +Iterator .

+

Refinement of

+

Default Constructible.

+

Associated types

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Value typevalue_type +The element type of the vector expression. +
Reference typereference +The return type when accessing an element of a vector expression. +
+Convertable to avalue_type. +
Const reference typeconst_reference +The return type when accessing an element of a constant vector expression. +
+Convertable to avalue_type. +
Size typesize_type +The index type of the vector expression. Am unsigned integral type used to represent size and index values. +
+Can represent any nonnegative value of difference_type. +
Distance typedifference_type +A signed integral type used to represent the distance between two of the vector expression's iterators. +
Const iterator typeconst_iteratorA type of iterator that may be used to examine a vector +expression's elements.
Iterator typeiteratorA type of iterator that may be used to modify a vector +expression's elements.
Const reverse iterator typeconst_reverse_iteratorA Reverse Iterator adaptor whose base iterator type is the +vector expression's const iterator type.
Reverse iterator typereverse_iteratorA Reverse Iterator adaptor whose base iterator type is the +vector expression's iterator type.
+

Notation

+ + + + + + + + + + + + + + + + + + + +
VA type that is a model of Vector Expression
v, v1, v2Object of type V
iObject of a type convertible to size_type
tObject of a type convertible to value_type
+

Definitions

+

Valid expressions

+

In addition to the expressions defined in Default Constructible +the following expressions must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Beginning of rangev.begin () const_iterator
v.begin ()v is mutable.iterator
End of rangev.end () const_iterator
v.end ()v is mutable.iterator
Sizev.size () size_type
Swapv1.swap (v2)v1 and v2 are mutable.void
Beginning of reverse rangev.rbegin () const_reverse_iterator
v.rbegin ()v is mutable.reverse_iterator
End of reverse rangev.rend () const_reverse_iterator
v.rend ()v is mutable.reverse_iterator
Element accessv (i)i is convertible to size_type.Convertible to value_type.
Assignmentv2 = v1v2 is mutable and v1 is convertible +to V.V &
v2.assign (v1)v2 is mutable and v1 is convertible +to V.V &
Computed assignmentv2 += v1v2 is mutable and v1 is convertible +to V.V &
v2.plus_assign (v1)v2 is mutable and v1 is convertible +to V.V &
v2 -= v1v2 is mutable and v1 is convertible +to V.V &
v2.minus_assign (v1)v2 is mutable and v1 is convertible +to V.V &
v *= tv is mutable and t is convertible to +value_type.V &
+

Expression semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in Default Constructible.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Beginning of rangev.begin () Returns an iterator pointing to the first element in the vector +expression.v.begin () is either dereferenceable or +past-the-end. It is past-the-end if and only if v.size () == +0.
End of rangev.end () Returns an iterator pointing one past the last element in the +vector expression.v.end () is past-the-end.
Sizev.size () Returns the size of the vector expression, that is, its number +of elements.v.size () >= 0
Swapv1.swap (v2) Equivalent to swap (v1, v2). 
Beginning of reverse rangev.rbegin () Equivalent to reverse_iterator (v.end ()).v.rbegin () is either dereferenceable or +past-the-end. It is past-the-end if and only if v.size () == +0.
End of reverse rangev.rend () Equivalent to reverse_iterator (v.begin ()).v.rend () is past-the-end.
Element accessv (i)0 <= i < v.size ()Returns the i-th element of the vector +expression. 
Assignmentv2 = v1v1.size () == v2.size ()Assigns every element of the evaluated vector expression +v1 to the corresponding element of v2 +. 
v2.assign (v1)v1.size () == v2.size ()Assigns every element of v1 to the corresponding +element of v2. 
Computed assignmentv2 += v1v1.size () == v2.size ()Adds every element of the evaluated vector expression +v1 to the corresponding element of +v2. 
v2.plus_assign (v1)v1.size () == v2.size ()Adds every element of v1 to the corresponding +element of v2. 
v2 -= v1v1.size () == v2.size ()Subtracts every element of the evaluated vector expression +v1 from the corresponding element of v2 +. 
v2.minus_assign (v1)v1.size () == v2.size ()Subtracts every element of v1 from the +corresponding element of v2. 
v *= t Multiplies every element of v with t +. 
+

Complexity guarantees

+

The run-time complexity of begin () and end +() is specific for the evaluated vector expression, +typically amortized constant time.

+

The run-time complexity of size () is constant +time.

+

The run-time complexity of swap () is specific for +the evaluated vector expression, typically constant time.

+

The run-time complexity of rbegin () and rend +() is specific for the evaluated vector expression, +typically amortized constant time.

+

The run-time complexity of the element access is specific for +the evaluated vector expression, typically amortized constant time +for the dense and logarithmic for the sparse case.

+

The run-time complexity of the arithmetic operations is specific +for the evaluated vector expressions, typically linear in the size +of the expressions.

+

Invariants

+ + + + + + + + + + + + + + + + + + + +
Valid rangeFor any vector expression v, [v.begin (), +v.end ()) is a valid range.
CompletenessAn algorithm that iterates through the range [v.begin (), +v.end ()) will pass through every element of v +.
Valid reverse range[v.rbegin (), v.rend ()) is a valid range.
Equivalence of rangesThe distance from v.begin () to v.end +() is the same as the distance from v.rbegin () +to v.rend ().
+

Models

+ + +

Matrix +Expression

+

Description

+

A Matrix Expression is an expression evaluatable to a matrix. +Matrix Expression provides an Indexed +Bidirectional Column/Row Iterator or an Indexed Random +Access Column/Row Iterator .

+

Refinement of

+

Default Constructible.

+

Associated types

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Value typevalue_type +The element type of the matrix expression. +
Reference typereference +The return type when accessing an element of a matrix expression. +
+Convertable to avalue_type. +
Const reference typeconst_reference +The return type when accessing an element of a constant matrix expression. +
+Convertable to avalue_type. +
Size typesize_type +The index type of the matrix expression. Am unsigned integral type used to represent size and index values. +
+Can represent any nonnegative value of difference_type. +
Distance typedifference_type +A signed integral type used to represent the distance between two of the matrix expression's iterators. +
Const iterator typesconst_iterator1A type of column iterator that may be used to examine a matrix +expression's elements.
const_iterator2A type of row iterator that may be used to examine a matrix +expression's elements.
Iterator typesiterator1A type of column iterator that may be used to modify a matrix +expression's elements.
iterator2A type of row iterator that may be used to modify a matrix +expression's elements.
Const reverse iterator typesconst_reverse_iterator1A Reverse Iterator adaptor whose base iterator type is the +matrix expression's const column iterator type.
const_reverse_iterator2A Reverse Iterator adaptor whose base iterator type is the +matrix expression's const row iterator type.
Reverse iterator typesreverse_iterator1A Reverse Iterator adaptor whose base iterator type is the +matrix expression's column iterator type.
reverse_iterator2A Reverse Iterator adaptor whose base iterator type is the +matrix expression's row iterator type.
+

Notation

+ + + + + + + + + + + + + + + + + + + +
MA type that is a model of Matrix Expression
m, m1, m2Object of type M
i, jObjects of a type convertible to size_type
tObject of a type convertible to value_type
+

Definitions

+

Valid expressions

+

In addition to the expressions defined in Default Constructible +the following expressions must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Beginning of rangem.begin1 () const_iterator1
m.begin2 () const_iterator2
m.begin1 ()m is mutable. iterator1
m.begin2 ()m is mutable.iterator2
End of rangem.end1 () const_iterator1
m.end2 () const_iterator2
m.end1 ()m is mutable. iterator1
m.end2 ()m is mutable.iterator2
Sizem.size1 () size_type
m.size2 () size_type
Swapm1.swap (m2)m1 and m2 are mutable. void
Beginning of reverse rangem.rbegin1 () const_reverse_iterator1
m.rbegin2 () const_reverse_iterator2
m.rbegin1 ()m is mutable. reverse_iterator1
m.rbegin2 ()m is mutable.reverse_iterator2
End of reverse rangem.rend1 () const_reverse_iterator1
m.rend2 () const_reverse_iterator2
m.rend1 ()m is mutable.reverse_iterator1
m.rend2 ()m is mutable.reverse_iterator2
Element accessm (i, j)i and j are convertible to +size_type .Convertible to value_type.
Assignmentm2 = m1m2 is mutable and m1 is convertible +to M.M &
m2.assign (m1)m2 is mutable and m1 is convertible +to M.M &
Computed assignmentm2 += m1m2 is mutable and m1 is convertible +to M.M &
m2.plus_assign (m1)m2 is mutable and m1 is convertible +to M.M &
m2 -= m1m2 is mutable and m1 is convertible +to M.M &
m2.minus_assign (m1)m2 is mutable and m1 is convertible +to M.M &
m *= tm is mutable and t is convertible to +value_type.M &
+

Expression semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in Default Constructible.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Beginning of rangem.begin1 () Returns an iterator pointing to the first element in the first +column of a matrix expression.m.begin1 () is either dereferenceable or +past-the-end. It is past-the-end if and only if m.size1 () == +0.
m.begin2 () Returns an iterator pointing to the first element in the first +row of a matrix expression.m.begin2 () is either dereferenceable or +past-the-end. It is past-the-end if and only if m.size2 () == +0.
End of rangem.end1 () Returns an iterator pointing one past the last element in the +matrix expression.m.end1 () is past-the-end.
m.end2 () Returns an iterator pointing one past the last element in the +matrix expression.m.end2 () is past-the-end.
Sizem.size1 () Returns the number of rows of the matrix expression.m.size1 () >= 0
m.size2 () Returns the number of columns of the matrix expression.m.size2 () >= 0
Swapm1.swap (m2) Equivalent to swap (m1, m2). 
Beginning of reverse rangem.rbegin1 () Equivalent to reverse_iterator1 (m.end1 ()).m.rbegin1 () is either dereferenceable or +past-the-end. It is past-the-end if and only if m.size1 () == +0.
m.rbegin2 () Equivalent to reverse_iterator2 (m.end2 ()).m.rbegin2 () is either dereferenceable or +past-the-end. It is past-the-end if and only if m.size2 () == +0.
End of reverse rangem.rend1 () Equivalent to reverse_iterator1 (m.begin1 +()).m.rend1 () is past-the-end.
m.rend2 () Equivalent to reverse_iterator2 (m.begin2 +()).m.rend2 () is past-the-end.
Element accessm (i, j)0 <= i < m.size1 () and 0 <= j < +m.size2 ()Returns the j-th element of the i-th +row of the matrix expression. 
Assignmentm2 = m1m1.size1 () == m2.size1 () and
+m1.size2 () == m2.size2 ()
Assigns every element of the evaluated matrix expression +m1 to the corresponding element of m2 +. 
m2.assign (m1)m1.size1 () == m2.size1 () and
+m1.size2 () == m2.size2 ()
Assigns every element of m1 to the corresponding +element of m2. 
Computed assignmentm2 += m1m1.size1 () == m2.size1 () and
+m1.size2 () == m2.size2 ()
Adds every element of the evaluated matrix expression +m1 to the corresponding element of +m2. 
m2.plus_assign (m1)m1.size1 () == m2.size1 () and
+m1.size2 () == m2.size2 ()
Adds every element of m1 to the corresponding +element of m2. 
m2 -= m1m1.size1 () == m2.size1 () and
+m1.size2 () == m2.size2 ()
Subtracts every element of the evaluated matrix expression +m1 from the corresponding element of m2 +. 
m2.minus_assign (m1)m1.size1 () == m2.size1 () and
+m1.size2 () == m2.size2 ()
Subtracts every element of m1 from the +corresponding element of m2. 
m *= t Multiplies every element of m with t +. 
+

Complexity guarantees

+

The run-time complexity of begin1 (), begin2 +() , end1 () and end2 () is +specific for the evaluated matrix expression.

+

The run-time complexity of size1 () and size2 +() is constant time.

+

The run-time complexity of swap () is specific for +the evaluated matrix expression, typically constant time.

+

The run-time complexity of rbegin1 (), +rbegin2 () , rend1 () and rend2 +() is specific for the evaluated matrix expression.

+

The run-time complexity of the element access is specific for +the evaluated matrix expression, typically amortized constant time +for the dense and logarithmic for the sparse case.

+

The run-time complexity of the arithmetic operations is specific +for the evaluated matrix expressions, typically quadratic in the +size of the proxies.

+

Invariants

+ + + + + + + + + + + + + + + + + + + +
Valid rangeFor any matrix expression m, [m.begin1 (), +m.end1 ()) and [m.begin2 (), m.end2 ()) are +valid ranges.
CompletenessAn algorithm that iterates through the range [m.begin1 +(), m.end1 ()) will pass through every row of m +, an algorithm that iterates through the range [m.begin2 (), +m.end2 ()) will pass through every column of m +.
Valid reverse range[m.rbegin1 (), m.rend1 ()) and [m.rbegin2 +(), m.rend2 ()) are valid ranges.
Equivalence of rangesThe distance from m.begin1 () to m.end1 +() is the same as the distance from m.rbegin1 +() to m.rend1 () and the distance from +m.begin2 () to m.end2 () is the same as +the distance from m.rbegin2 () to m.rend2 +().
+

Models

+ +
+

Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
+Permission to copy, use, modify, sell and distribute this document +is granted provided this copyright notice appears in all copies. +This document is provided ``as is'' without express or implied +warranty, and with no claim as to its suitability for any +purpose.

+

Last revised: 1/15/2003

+ + diff --git a/doc/iterator_concept.htm b/doc/iterator_concept.htm new file mode 100644 index 00000000..dd2a5281 --- /dev/null +++ b/doc/iterator_concept.htm @@ -0,0 +1,1182 @@ + + + + + + +Iterator Concepts + + +

c++boost.gif +Iterator Concepts

+

An Iterator is a restricted pointer-like object pointing into a +vector or matrix container.

+

Indexed Bidirectional +Iterator

+

Description

+

An Indexed Bidirectional Iterator is an iterator of a container +that can be dereferenced, incremented, decremented and carries +index information.

+

Refinement of

+

Assignable, Equality Comparable, Default Constructible.

+

Associated types

+ + + + + + + + + + + +
Value typeThe type of the value obtained by dereferencing a Indexed +Bidirectional Iterator
Container typeThe type of the container a Indexed Bidirectional Iterator +points into.
+

Notation

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
IA type that is a model of Indexed Bidirectional Iterator
TThe value type of I
CThe container type of I
it, itt, it1, it2Objects of type I
tObject of type T
cObject of type C
+

Definitions

+

A Indexed Bidirectional Iterator may be mutable, meaning +that the values referred to by objects of that type may be +modified, or constant , meaning that they may not. If an +iterator type is mutable, this implies that its value type is a +model of Assignable; the converse, though, is not necessarily +true.

+

A Indexed Bidirectional Iterator may have a singular +value, meaning that the results of most operations, including +comparison for equality, are undefined. The only operation that is +guaranteed to be supported is assigning a nonsingular iterator to a +singular iterator.

+

A Indexed Bidirectional Iterator may have a +dereferenceable value, meaning that dereferencing it yields +a well-defined value. Dereferenceable iterators are always +nonsingular, but the converse is not true.

+

An Indexed Bidirectional Iterator is past-the-end if it +points beyond the last element of a container. Past-the-end values +are nonsingular and nondereferenceable.

+

Valid expressions

+

In addition to the expressions defined for Assignable, Equality +Comparable and Default Constructible, the following expressions +must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Default constructorI it  
Dereference*it Convertible to T.
Dereference assignment*it = tI is mutable. 
Member accessit->mT is a type for which t.m is +defined. 
Preincrement++ it I &
Postincrementit ++ I
Predecrement-- it I &
Postdecrementit -- I
Indexit.index () C::size_type
+

Expression Semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in, Assignable, Equality Comparable and +Default Constructible.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Default constructorI it  it is singular.
Dereference*itit is dereferenceable.  
Dereference assignment*it = tSame as for *it. *it is a copy of t.
Member accessit->mit is dereferenceable.Equivalent to (*it).m 
Preincrement++ itit is dereferenceable.it is modified to point to the next element.it is dereferenceable or past-the-end. +
+&it == &++ it
.
+If it1 == it2,
+then ++ it1 == ++ it2.
Postincrementit ++Same as for ++ it.Equivalent to
+{
+ I itt = it;
+ ++ it;
+ return itt;
+}
it is dereferenceable or past-the-end.
Predecrement-- itit is dereferenceable or past-the-end.
+There exists a dereferenceable iterator itt such that +it == ++ itt.
it is modified to point to the previous +element.it is dereferenceable.
+&it = &-- it.
+If it1 == it2,
+then -- it1 == -- it2.
+If it2 is dereferenceable and it1 == +++it2,
+then --it1 == it2.
Postdecrementit --Same as for -- it.Equivalent to
+{
+ I itt = it;
+ -- it;
+ return itt;
+}
it is dereferenceable. 
Indexit.index ()it is dereferenceable.it.index () >= 0
+and
+it.index () < it ().size ()
If it1 == it2,
+then it1.index () == it2.index ().
+If it1 == it2,
+then it1.index () < (++ it2).index +().
+If it1 == it2,
+then it1.index () > (-- it2).index +().
+

Complexity guarantees

+

The complexity of operations on indexed bidirectional iterators +is guaranteed to be amortized constant time.

+

Invariants

+ + + + + + + + + + + + + + + +
Identityit1 == it2 if and only if &*it1 == +&*it2.
Symmetry of increment and decrementIf it is dereferenceable, then ++ it; +--it; is a null operation. Similarly, -- it; ++ +it; is a null operation.
Relation between iterator index and container element +operatorIf it is dereferenceable, *it == it () +(it.index ()).
+

Models

+ +

Indexed Random Access +Iterator

+

Description

+

An Indexed Random Access Iterator is an iterator of a container +that can be dereferenced, moved forward, moved backward and carries +index information.

+

Refinement of

+

LessThanComparable, Indexed Bidirectional +Iterator .

+

Associated types

+ + + + + + + + + + + +
Value typeThe type of the value obtained by dereferencing a Indexed +Random Access Iterator
Container typeThe type of the container a Indexed Random Access Iterator +points into.
+

Notation

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
IA type that is a model of Indexed Random Access Iterator
TThe value type of I
CThe container type of I
it, itt, it1, it2Objects of type I
tObject of type T
nObject of type C::difference_type
+

Definitions

+

An Indexed Random Access Iterator it1 is +reachable from an Indexed Random Access Iterator +it2 if, after applying operator ++ to +it2 a finite number of times, it1 == +it2.

+

Valid expressions

+

In addition to the expressions defined for Indexed Bidirectional +Iterator , the following expressions must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Forward motionit += n I &
Iterator additionit + n I
Backward motioni -= n I &
Iterator subtractionit - n I 
Differenceit1 - it2 C::difference_type
Element operatorit [n] Convertible to T.
Element assignmentit [n] = tI is mutableConvertible to T.
+

Expression Semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in, Indexed Bidirectional +Iterator .

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Forward motionit += nIncluding it itself, there must be n +dereferenceable or past-the-end iterators following or preceding +it, depending on whether n is positive or +negative.If n > 0, equivalent to executing ++ +it n times. If n < 0, +equivalent to executing -- it n times. If +n == 0, this is a null operation.it is dereferenceable or past-the-end.
Iterator additionit + nSame as for i += n.Equivalent to
+{
+ I itt = it;
+ return itt += n;
+}
Result is dereferenceable or past-the-end.
Backward motionit -= nIncluding it itself, there must be n +dereferenceable or past-the-end iterators preceding or following +it, depending on whether n is positive or +negative.Equivalent to it += (-n).it is dereferenceable or past-the-end.
Iterator subtractionit - nSame as for i -= n.Equivalent to
+{
+ I itt = it;
+ return itt -= n;
+}
Result is dereferenceable or past-the-end.
Differenceit1 - it2Either it1 is reachable from it2 or +it2 is reachable from it1, or both.Returns a number n such that it1 == it2 + +n 
Element operatorit [n]it + n exists and is dereferenceable.Equivalent to *(it + n) 
Element assignmenti[n] = tSame as for it [n].Equivalent to *(it + n) = t 
+

Complexity guarantees

+

The complexity of operations on indexed random access iterators +is guaranteed to be amortized constant time.

+

Invariants

+ + + + + + + + + + + + + + + +
Symmetry of addition and subtractionIf it + n is well-defined, then it += n; it +-= n; and (it + n) - n are null operations. +Similarly, if it - n is well-defined, then it -= +n; it += n; and (it - n) + n are null +operations.
Relation between distance and additionIf it1 - it2 is well-defined, then it1 == +it2 + (it1 - it2).
Reachability and distanceIf it1 is reachable from it2, then +it1 - it2 >= 0.
+

Models

+ +

Indexed Bidirectional +Column/Row Iterator

+

Description

+

An Indexed Bidirectional Column/Row Iterator is an iterator of a +container that can be dereferenced, incremented, decremented and +carries index information.

+

Refinement of

+

Assignable, Equality Comparable, Default Constructible.

+

Associated types

+ + + + + + + + + + + +
Value typeThe type of the value obtained by dereferencing a Indexed +Bidirectional Column/Row Iterator
Container typeThe type of the container a Indexed Bidirectional Column/Row +Iterator points into.
+

Notation

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
I1A type that is a model of Indexed Bidirectional Column/Row +Iterator
I2A type that is a model of Indexed Bidirectional Row/Column +Iterator
TThe value type of I1 and I2
CThe container type of I1 and I2
it1, it1t, it11, +it12Objects of type I1
it2, it2tObjects of type I2
tObject of type T
cObject of type C
+

Definitions

+

Valid expressions

+

In addition to the expressions defined for Assignable, Equality +Comparable and Default Constructible, the following expressions +must be valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Default constructorI1 it1  
Dereference*it1 Convertible to T.
Dereference assignment*it1 = tI1 is mutable. 
Member accessit1->mT is a type for which t.m is +defined. 
Preincrement++ it1 I1 &
Postincrementit1 ++ I1
Predecrement-- it1 I1 &
Postdecrementit1 -- I1
Row Indexit1.index1 () C::size_type
Column Indexit1.index2 () C::size_type
Row/Column Beginit1.begin () I2
Row/Column Endit1.end () I2
Reverse Row/Column Beginit1.rbegin () reverse_iterator<I2>
Reverse Row/Column Endit1.rend () reverse_iterator<I2>
+

Expression Semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in, Assignable, Equality Comparable and +Default Constructible.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Default constructorI1 it1  it1 is singular.
Dereference*it1it1 is dereferenceable.  
Dereference assignment*it1 = tSame as for *it1. *it1 is a copy of t.
Member accessit1->mit1 is dereferenceable.Equivalent to (*it1).m 
Preincrement++ it1it1 is dereferenceable.it1 is modified to point to the next element of +the column/row, i.e. for column iterators holds
+it1.index1 () < (++ it1).index1 () and
+it1.index2 () == (++ it1).index2 (),
+for row iterators holds
+it1.index1 () == (++ it1).index1 () and
+it1.index2 () < (++ it1).index2 ().
it1 is dereferenceable or past-the-end. +
+&it1 == &++ it1
.
+If it11 == it12,
+then ++ it11 == ++ it12.
Postincrementit1 ++Same as for ++ it1.Equivalent to
+{
+ I1 it1t = it1;
+ ++ it1;
+ return it1t;
+}
it1 is dereferenceable or past-the-end.
Predecrement-- it1it1 is dereferenceable or past-the-end.
+There exists a dereferenceable iterator it1t such that +it1 == ++ it1t.
it1 is modified to point to the previous  +element of the column/row, i.e. for column iterators holds
+it1.index1 () > (-- it1).index1 () and
+it1.index2 () == (-- it1).index2 (),
+for row iterators holds
+it1.index1 () == (-- it1).index1 () and
+it1.index2 () > (-- it1).index2 ().
it1 is dereferenceable.
+&it1 = &-- it1.
+If it11 == it12,
+then -- it11 == -- it12.
Postdecrementit1 --Same as for -- it1.Equivalent to
+{
+ I1 it1t = it1;
+ -- it1;
+ return it1t;
+}
it1 is dereferenceable. 
Row Indexit1.index1 ()it1 is dereferenceable.it1.index1 () >= 0 and
+it1.index1 () < it () .size1 ()
If it11 == it12,
+then it11.index1 () == it12.index1 () +.
+If it11, it12 are Indexed Bidirectional +Row Iterators with it11 == it12,
+then it11.index1 () < (++ it12).index1 +().
+If it11, it12 are Indexed Bidirectional +Row Iterators with it11 == it12,
+then it11.index1 () > (-- it12).index1 +().
Column Indexit1.index2 ()it1 is dereferenceable.it1.index2 () >= 0 and
+it1.index2 () < it () .size2 ()
If it11 == it12,
+then it11.index2 () == it12.index2 () +.
+If it11, it12 are Indexed Bidirectional +Column Iterators with it11 == it12,
+then it11.index2 () < (++ it12).index2 +().
+If it11, it12 are Indexed Bidirectional +Column Iterators with it11 == it12,
+then it11.index2 () > (-- it12).index2 +().
Row/Column Beginit1.begin ()it1 is dereferenceable.If it1 is a Indexed Bidirectional Column +Iterator,
+then it2 = it1.begin () is a Indexed Bidirectional Row +Iterator
+with it2.index1 () == it1.index1 (). +

If it1 is a Indexed Bidirectional Row +Iterator,
+then it2 = it1.begin () is a Indexed Bidirectional +Column Iterator
+with it2.index2 () == it1.index2 ().

+
 
Row/Column Endit1.end ()it1 is dereferenceable.If it1 is a Indexed Bidirectional Column +Iterator,
+then it2 = it1.end () is a Indexed Bidirectional Row +Iterator
+with it2.index1 () == it1.index1 (). +

If it1 is a Indexed Bidirectional Row +Iterator,
+then it2 = it1.end () is a Indexed Bidirectional +Column Iterator
+with it2.index2 () == it1.index2 ().

+
 
Reverse Row/Column Beginit1.rbegin ()it1 is dereferenceable.Equivalent to reverse_iterator<I2> (it1.end +()). 
Reverse Row/Column Endit1.rend ()it1 is dereferenceable.Equivalent to reverse_iterator<I2> (it1.begin +()). 
+

Complexity guarantees

+

The complexity of operations on indexed bidirectional column/row +iterators is guaranteed to be logarithmic depending on the size of +the container. The complexity of one iterator (depending on the +storage layout) can be lifted to be amortized constant time. The +complexity of the other iterator (depending on the storage layout +and the container) can be lifted to be amortized constant time for +the first row/first column respectively.

+

Invariants

+ + + + + + + + + + + + + + + + + + + + + + + +
Identityit11 == it12 if and only if &*it11 == +&*it12.
Symmetry of increment and decrementIf it1 is dereferenceable, then ++ it1; +--it1; is a null operation. Similarly, -- it1; ++ +it1; is a null operation.
Relation between iterator index and container element +operatorIf it1 is dereferenceable, *it1 == it1 () +(it1.index1 (), it2.index2 ())
Relation between iterator column/row begin and iterator +indexIf it1 is a Indexed Bidirectional Column Iterator +and it2 = it1.begin () then it2.index2 () < +it2t.index2 () for all it2t with it2t () +== it2 () and it2t ().index1 () == it2 ().index1 +(). +

If it1 is a Indexed Bidirectional Row Iterator and +it2 = it1.begin () then it2.index1 () < +it2t.index1 () for all it2t with it2t () +== it2 () and it2t ().index2 () == it2 ().index2 +().

+
Relation between iterator column/row end and iterator +indexIf it1 is a Indexed Bidirectional Column Iterator +and it2 = it1.end () then it2.index2 () > +it2t.index2 () for all it2t with it2t () +== it2 () and it2t ().index1 () == it2 ().index1 +(). +

If it1 is a Indexed Bidirectional Row Iterator and +it2 = it1.end () then it2.index1 () > +it2t.index1 () for all it2t with it2t () +== it2 () and it2t ().index2 () == it2 ().index2 +().

+
+

Models

+ +

Indexed Random Access +Column/Row Iterator

+

Description

+

An Indexed Random Access Column/Row Iterator is an iterator of a +container that can be dereferenced, incremented, decremented and +carries index information.

+

Refinement of

+

Indexed +Bidirectional Column/Row Iterator .

+

Associated types

+ + + + + + + + + + + +
Value typeThe type of the value obtained by dereferencing a Indexed +Random Access Column/Row Iterator
Container typeThe type of the container a Indexed Random Access Column/Row +Iterator points into.
+

Notation

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
IA type that is a model of Indexed Random Access Column/Row +Iterator
TThe value type of I
CThe container type of I
it, itt, it1, it2Objects of type I
tObject of type T
cObject of type C
+

Definitions

+

Valid expressions

+

In addition to the expressions defined for Indexed Bidirectional +Column/Row Iterator , the following expressions must be +valid.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Forward motionit += n I &
Iterator additionit + n I
Backward motioni -= n I &
Iterator subtractionit - n I 
Differenceit1 - it2 C::difference_type
Element operatorit [n] Convertible to T.
Element assignmentit [n] = tI is mutableConvertible to T.
+

Expression Semantics

+

Semantics of an expression is defined only where it differs +from, or is not defined in, Indexed Bidirectional +Column/Row Iterator .

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition
Forward motionit += nIncluding it itself, there must be n +dereferenceable or past-the-end iterators following or preceding +it, depending on whether n is positive or +negative.If n > 0, equivalent to executing ++ +it n times. If n < 0, +equivalent to executing -- it n times. If +n == 0, this is a null operation.it is dereferenceable or past-the-end.
Iterator additionit + nSame as for i += n.Equivalent to
+{
+ I itt = it;
+ return itt += n;
+}
Result is dereferenceable or past-the-end.
Backward motionit -= nIncluding it itself, there must be n +dereferenceable or past-the-end iterators preceding or following +it, depending on whether n is positive or +negative.Equivalent to it += (-n).it is dereferenceable or past-the-end.
Iterator subtractionit - nSame as for i -= n.Equivalent to
+{
+ I itt = it;
+ return itt -= n;
+}
Result is dereferenceable or past-the-end.
Differenceit1 - it2Either it1 is reachable from it2 or +it2 is reachable from it1, or both.Returns a number n such that it1 == it2 + +n 
Element operatorit [n]it + n exists and is dereferenceable.Equivalent to *(it + n) 
Element assignmenti[n] = tSame as for it [n].Equivalent to *(it + n) = t 
+

Complexity guarantees

+

The complexity of operations on indexed random access Column/Row +iterators is guaranteed to be amortized constant time.

+

Invariants

+ + + + + + + + + + + + + + + +
Symmetry of addition and subtractionIf it + n is well-defined, then it += n; it +-= n; and (it + n) - n are null operations. +Similarly, if it - n is well-defined, then it -= +n; it += n; and (it - n) + n are null +operations.
Relation between distance and additionIf it1 - it2 is well-defined, then it1 == +it2 + (it1 - it2).
Reachability and distanceIf it1 is reachable from it2, then +it1 - it2 >= 0.
+

Models

+ +
+

Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
+Permission to copy, use, modify, sell and distribute this document +is granted provided this copyright notice appears in all copies. +This document is provided ``as is'' without express or implied +warranty, and with no claim as to its suitability for any +purpose.

+

Last revised: 9/17/2004

+ + diff --git a/doc/range.htm b/doc/range.htm new file mode 100644 index 00000000..eb1971c4 --- /dev/null +++ b/doc/range.htm @@ -0,0 +1,210 @@ + + + + + +Range and slice + + +

c++boost.gif +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

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MemberDescription
range (size_type start, size_type stop)Constructs a range of indicies from start to stop (excluded) +.
size_type start () constReturns the beginning of the range.
size_type size () constReturns the size of the range.
const_reference operator [] (size_type i) +constReturns the value start + i of the i +-th element.
range compose (const range &r) constReturns the composite range from start + r.start +() to start + r.start () + r.size ().
bool operator == (const range &r) constTests two ranges for equality.
bool operator != (const range &r) constTests two ranges for inequality.
const_iterator begin () constReturns a const_iterator pointing to the beginning +of the range.
const_iterator end () constReturns a const_iterator pointing to the end of +the range.
const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the +beginning of the reversed range.
const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the +end of the reversed range.
+

Preconditions

+ + +

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

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MemberDescription
slice (size_type start, size_type stride, size_type +size)Constructs a slice start,start+stride,start+2*stride... with +size elements.
size_type start () constReturns the beginning of the slice.
size_type stride () constReturns the stride of the slice.
size_type size () constReturns the size of the slice.
const_reference operator [] (size_type i) +constReturns the value start + i * stride of the +i-th element.
slice compose (const range &r) constReturns the composite slice from start + stride * r.start +() to start + stride * (r.start () + r.size ()) +with stride stride.
slice compose (const slice &s) constReturns the composite slice from start + stride * s.start +() to start + stride * s.stride () * (s.start () + +s.size ()) with stride stride * s.stride () +.
bool operator == (const slice &s) constTests two slices for equality.
bool operator != (const slice &s) constTests two slices for inequality.
const_iterator begin () constReturns a const_iterator pointing to the beginning +of the slice.
const_iterator end () constReturns a const_iterator pointing to the end of +the slice.
const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the +beginning of the reversed slice.
const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the +end of the reversed slice.
+

Preconditions

+ + + diff --git a/doc/storage_concept.htm b/doc/storage_concept.htm new file mode 100644 index 00000000..95b8a56e --- /dev/null +++ b/doc/storage_concept.htm @@ -0,0 +1,139 @@ + + + + + + +Storage concept + + +

c++boost.gif +Storage concept

+

Storage concept

+

Description

+

Storage is a variable-size container whose elements are arranged in a strict linear order. +

Storage extends the Container concept with some Sequence-like functionality. The main difference with +the Sequence concept however is that the Storage concept does not require default-initialisation of its +elements. +

Refinement of

+Random Access Container +and +Default Constructible +

Associated types

+No additional types beyond those defined by +Random Access Container +

Notation

+ + + + + +
XA type that is model of Storage
TThe value_type of X
tAn object of type T
nobject of type convertible to X::size_type
+

Definitions

+

Valid expressions

+In addition to the expressions defined in +Random Access Container, +and +Default Constructible +the following expressions must be valid: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionType requirementsReturn type
Size constructorX(n)T is DefaultConstructibleX
Fill constructorX(n,t)X
Range constructorX(i, j)i and j are Input Iterators whose value type is convertible to T X
Resizea.resize(n, t)a is mutablevoid
Resizea.resize(n)a is mutablevoid
+

Expression semantics

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameExpressionPreconditionSemanticsPostcondition +
Default-constructorX() +Creates 0 elements. +size()==0
Size-constructorX(n) +n>=0Creates n elements. Elements are constructed without an initializer. That is +if T is a (possibly cv-qualified) non-POD class type (or array thereof), the object is default +initialized. Otherwise, the object created has indeterminate value. See the sentance +"If new initializer is omitted" in section 5.3.4 paragraph 15 of the ISO C++ standard. +size()==n
Fill-constructorX(n,t) +n>=0Creates n initialised element with copies of tsize()==n
Range constructorX(i, j)[i,j) is a valid range.copies the range [i,j) to the storagesize() is equal to the distance from i to j. Each element is a copy of the corresponding element in the range [i,j).
Resizea.resize(n, t)n <= a.max_size()Modified the container so that it has exactly n elements.
+The container may be reallocated if its size changes. +Existing element values are preserved, additional elements are copies of t.
a.size() == n
Resizea.resize(n)n <= a.max_size()Modified the container so that it has exactly n elements.
+The container may be reallocated if its size changes. Element values are undefined. That is +each element value may be a previously assigned value or the value when it was constructed.
a.size() == n
+

Complexity guarantees

+

Invariants

+

Models

+ +

Notes

+ diff --git a/doc/tidy.htm b/doc/tidy.htm new file mode 100644 index 00000000..be93dc8f --- /dev/null +++ b/doc/tidy.htm @@ -0,0 +1,758 @@ + + + + + + +Vector + + +

c++boost.gif +Vector

+

Vector

+

Description

+

The templated class vector<T, A> is the base +container adaptor for dense vectors. For a n-dimensional +vector and 0 <= i < n every element +vi is mapped to the i-th +element of the container.

+

Example

+
+#include <boost/numeric/ublas/vector.hpp>
+#include <boost/numeric/ublas/io.hpp>
+
+int main () {
+    using namespace boost::numeric::ublas;
+    vector<double> v (3);
+    for (unsigned i = 0; i < v.size (); ++ i)
+        v (i) = i;
+    std::cout << v << std::endl;
+}
+
+

Definition

+

Defined in the header vector.hpp.

+

Template parameters

+ + + + + + + + + + + + + + + + + + +
ParameterDescriptionDefault
TThe type of object stored in the vector.
AThe type of the adapted array. [1]unbounded_array<T>
+

Model of

+

Vector .

+

Type requirements

+

None, except for those imposed by the requirements of Vector .

+

Public base classes

+

vector_expression<vector<T, A> >

+

Members

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MemberWhere definedDescription
value_typeVectorExpression
referenceVectorExpression
const_referenceVectorExpression
size_typeVectorExpression
difference_typeVectorExpression
const_iteratorVectorExpression
iteratorVectorExpression
const_reverse_iteratorVectorExpression
reverse_iteratorVectorExpression
array_typeVector
vector ()VectorExpressionAllocates an uninitialized vector that holds zero +elements.
vector (size_type size)VectorAllocates an uninitialized vector that holds +size elements.
vector (const vector &v)The copy constructor.
template<class AE>
+vector (const vector_expression<AE> &ae)
The extended copy constructor.
void resize (size_type size, bool preserve = +true)VectorReallocates a vector to hold size +elements. The existing elements of the vector are +preseved when specified.
size_type size () constVectorExpressionReturns the size of the vector.
const array_type& data () constVector
array_type& data ()Vector
const_reference operator () (size_type i) +constVectorExpressionReturns a const reference of the i +-th element.
reference operator () (size_type i)VectorExpressionReturns a reference of the i-th element.
const_reference operator [] (size_type i) +constVectorReturns a const reference of the i +-th element.
reference operator [] (size_type i)VectorReturns a reference of the i-th element.
vector &operator = (const vector &v)VectorExpressionThe assignment operator.
vector &assign_temporary (vector &v)VectorExpressionAssigns a temporary. May change the vector v.
template<class AE>
+vector &operator = (const vector_expression<AE> +&ae)
VectorExpressionThe extended assignment operator.
template<class AE>
+vector &assign (const vector_expression<AE> +&ae)
VectorExpressionAssigns a vector expression to the vector. Left and right hand +side of the assignment should be independent.
template<class AE>
+vector &operator += (const vector_expression<AE> +&ae)
VectorExpressionA computed assignment operator. Adds the vector expression to +the vector.
template<class AE>
+vector &plus_assign (const vector_expression<AE> +&ae)
VectorExpressionAdds a vector expression to the vector. Left and right hand +side of the assignment should be independent.
template<class AE>
+vector &operator -= (const vector_expression<AE> +&ae)
VectorExpressionA computed assignment operator. Subtracts the vector expression +from the vector.
template<class AE>
+vector &minus_assign (const vector_expression<AE> +&ae)
VectorExpressionSubtracts a vector expression from the vector. Left and right +hand side of the assignment should be independent.
template<class AT>
+vector &operator *= (const AT &at)
VectorExpressionA computed assignment operator. Multiplies the vector with a +scalar.
template<class AT>
+vector &operator /= (const AT &at)
VectorExpressionA computed assignment operator. Divides the vector through a +scalar.
void swap (vector &v)VectorExpressionSwaps the contents of the vectors.
void insert (size_type i, const_reference t)VectorInserts the value t at the i-th +element.
void erase (size_type i)VectorErases the value at the i-th element.
void clear ()VectorClears the vector.
const_iterator begin () constVectorExpressionReturns a const_iterator pointing to the beginning +of the vector.
const_iterator end () constVectorExpressionReturns a const_iterator pointing to the end of +the vector.
iterator begin ()VectorExpressionReturns a iterator pointing to the beginning of +the vector.
iterator end ()VectorExpressionReturns a iterator pointing to the end of the +vector.
const_reverse_iterator rbegin () constVectorExpressionReturns a const_reverse_iterator pointing to the +beginning of the reversed vector.
const_reverse_iterator rend () constVectorExpressionReturns a const_reverse_iterator pointing to the +end of the reversed vector.
reverse_iterator rbegin ()VectorExpressionReturns a reverse_iterator pointing to the +beginning of the reversed vector.
reverse_iterator rend ()VectorExpressionReturns a reverse_iterator pointing to the end of +the reversed vector.
+

Notes

+

[1] Supported parameters +for the adapted array are unbounded_array<T> , +bounded_array<T> and +std::vector<T> .

+

Unit Vector

+

Description

+

The templated class unit_vector<T> represents +canonical unit vectors. For the k-th +n-dimensional canonical unit vector and 0 <= i < +n holds uki += 0, if i <> k, and +uki = +1.

+

Example

+
+#include <boost/numeric/ublas/vector.hpp>
+#include <boost/numeric/ublas/io.hpp>
+
+int main () {
+    using namespace boost::numeric::ublas;
+    for (int i = 0; i < 3; ++ i) {
+        unit_vector<double> v (3, i);
+        std::cout << v << std::endl;
+    }
+}
+
+

Definition

+

Defined in the header vector.hpp.

+

Template parameters

+ + + + + + + + + + + + + +
ParameterDescriptionDefault
TThe type of object stored in the vector.
+

Model of

+

Vector +Expression .

+

Type requirements

+

None, except for those imposed by the requirements of Vector Expression +.

+

Public base classes

+

vector_expression<unit_vector<T> >

+

Members

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MemberDescription
unit_vector ()Constructs an unit_vector that holds zero +elements.
unit_vector (size_type size, size_type index)Constructs the index-th unit_vector +that holds size elements.
unit_vector (const unit_vector &v)The copy constructor.
void resize (size_type size, bool preserve = +true)Resizes a unit_vector to hold size +elements. Therefore the existing elements of the +unit_vector are always preseved.
size_type size () constReturns the size of the unit_vector.
size_type index () constReturns the index of the unit_vector.
const_reference operator () (size_type i) +constReturns the value of the i-th element.
const_reference operator [] (size_type i) +constReturns the value of the i-th element.
unit_vector &operator = (const unit_vector +&v)The assignment operator.
unit_vector &assign_temporary (unit_vector +&v)Assigns a temporary. May change the unit vector v +.
void swap (unit_vector &v)Swaps the contents of the unit vectors.
const_iterator begin () constReturns a const_iterator pointing to the beginning +of the unit_vector.
const_iterator end () constReturns a const_iterator pointing to the end of +the unit_vector.
const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the +beginning of the reversed unit_vector.
const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the +end of the reversed unit_vector.
+

Zero Vector

+

Description

+

The templated class zero_vector<T> represents +zero vectors. For a n-dimensional zero vector and 0 +<= i < n holds zi = +0.

+

Example

+
+#include <boost/numeric/ublas/vector.hpp>
+#include <boost/numeric/ublas/io.hpp>
+
+int main () {
+    using namespace boost::numeric::ublas;
+    zero_vector<double> v (3);
+    std::cout << v << std::endl;
+}
+
+

Definition

+

Defined in the header vector.hpp.

+

Template parameters

+ + + + + + + + + + + + + +
ParameterDescriptionDefault
TThe type of object stored in the vector.
+

Model of

+

Vector +Expression .

+

Type requirements

+

None, except for those imposed by the requirements of Vector Expression +.

+

Public base classes

+

vector_expression<zero_vector<T> >

+

Members

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MemberDescription
zero_vector ()Constructs a zero_vector that holds zero +elements.
zero_vector (size_type size)Constructs a zero_vector that holds +size elements.
zero_vector (const zero_vector &v)The copy constructor.
void resize (size_type size, bool preserve = +true)Resizes a zero_vector to hold size +elements. Therefore the existing elements of the +zero_vector are always preseved.
size_type size () constReturns the size of the zero_vector.
const_reference operator () (size_type i) +constReturns the value of the i-th element.
const_reference operator [] (size_type i) +constReturns the value of the i-th element.
zero_vector &operator = (const zero_vector +&v)The assignment operator.
zero_vector &assign_temporary (zero_vector +&v)Assigns a temporary. May change the zero vector v +.
void swap (zero_vector &v)Swaps the contents of the zero vectors.
const_iterator begin () constReturns a const_iterator pointing to the beginning +of the zero_vector.
const_iterator end () constReturns a const_iterator pointing to the end of +the zero_vector.
const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the +beginning of the reversed zero_vector.
const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the +end of the reversed zero_vector.
+

Scalar +Vector

+

Description

+

The templated class scalar_vector<T> +represents scalar vectors. For a n-dimensional scalar +vector and 0 <= i < n holds +zi = s.

+

Example

+
+#include <boost/numeric/ublas/vector.hpp>
+#include <boost/numeric/ublas/io.hpp>
+
+int main () {
+    using namespace boost::numeric::ublas;
+    scalar_vector<double> v (3);
+    std::cout << v << std::endl;
+}
+
+

Definition

+

Defined in the header vector.hpp.

+

Template parameters

+ + + + + + + + + + + + + +
ParameterDescriptionDefault
TThe type of object stored in the vector.
+

Model of

+

Vector +Expression .

+

Type requirements

+

None, except for those imposed by the requirements of Vector Expression +.

+

Public base classes

+

vector_expression<scalar_vector<T> +>

+

Members

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MemberDescription
scalar_vector ()Constructs a scalar_vector that holds zero +elements.
scalar_vector (size_type size, const value_type +&value)Constructs a scalar_vector that holds +size elements each of the specified value.
scalar_vector (const scalar_vector &v)The copy constructor.
void resize (size_type size, bool preserve = +true)Resizes a scalar_vector to hold size +elements. Therefore the existing elements of the +scalar_vector are always preseved.
size_type size () constReturns the size of the scalar_vector.
const_reference operator () (size_type i) +constReturns the value of the i-th element.
const_reference operator [] (size_type i) +constReturns the value of the i-th element.
scalar_vector &operator = (const scalar_vector +&v)The assignment operator.
scalar_vector &assign_temporary (scalar_vector +&v)Assigns a temporary. May change the scalar vector +v .
void swap (scalar_vector &v)Swaps the contents of the scalar vectors.
const_iterator begin () constReturns a const_iterator pointing to the beginning +of the scalar_vector.
const_iterator end () constReturns a const_iterator pointing to the end of +the scalar_vector.
const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the +beginning of the reversed scalar_vector.
const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the +end of the reversed scalar_vector.
+
+

Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
+Permission to copy, use, modify, sell and distribute this document +is granted provided this copyright notice appears in all copies. +This document is provided ``as is'' without express or implied +warranty, and with no claim as to its suitability for any +purpose.

+

Last revised: 1/15/2003

+ + diff --git a/doc/unbounded_array.htm b/doc/unbounded_array.htm new file mode 100644 index 00000000..db6c759e --- /dev/null +++ b/doc/unbounded_array.htm @@ -0,0 +1,206 @@ + + + + + +Unbounded array + + +

c++boost.gif +Unbounded Array Storage

+

Unbounded Array<T,Alloc>

+

Description

+

The templated class unbounded_array<T, ALLOC> implements a unbounded storage array using an allocator. +The unbounded array is similar to a std::vector in that in can grow in size beyond any fixed bound. +However unbounded_array is aimed at optimal performance. Therefore unbounded_array does not model a +Sequence like std::vector does. +

When resized unbounded_array will reallocate it's storage even if the new size requirement is smaller. It is therefore inefficient to resize a unbounded_array

+

Example

+
+#include <boost/numeric/ublas/storage.hpp>
+
+int main () {
+    using namespace boost::numeric::ublas;
+    unbounded_array<double> a (3);
+    for (unsigned i = 0; i < a.size (); ++ i) {
+        a [i] = i;
+        std::cout << a [i] << std::endl;
+    }
+}
+
+

Definition

+

Defined in the header storage.hpp.

+

Template parameters

+ + + + + + + + + + + + + + + + + + +
ParameterDescriptionDefault
TThe type of object stored in the array.
ALLOCAn STL Allocatorstd::allocator
+

Model of

+

Storage

+

Type requirements

+

None, except for those imposed by the requirements of Random +Access Container.

+

Public base classes

+

None.

+

Members

+Editor's notes: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MemberWhere definedDescription
value_typeContainer
pointerContainerCurrently defined as value_type*
const_pointerCurrently defined as value_type*
referenceContainerCurrently defined as value_type&
const_referenceContainerCurrently defined as const value_type&
size_typeContainerCurrently defined as Alloc::size_type
difference_typeContainerCurrently defined as Alloc::difference_type
iteratorContainerCurrently defined as pointer
const_iteratorContainerCurrently defined as const_pointer
revere_iteratorContainerCurrently defined as std::reverse_iterator<iterator>
const_revere_iteratorContainerCurrently defined as std::reverse_iterator<const_iterator>
allocator_typeDefined as ALLOC
explicit unbounded_array (ALLOC &a = ALLOC())StorageCreates an unbounded_array that holds at most zero elements, using a specified allocator.
explicit unbounded_array (size_type size, ALLOC &a = ALLOC())StorageCreates a uninitialized unbounded_array that holds at most size elements, using a specified allocator. All the elements are constructed without an initializer.
explicit unbounded_array (size_type size, const T& init, ALLOC& a = ALLOC())StorageCreates an initialized unbounded_array that holds at most size elements, using a specified allocator. All the elements are constructed from the init value.
unbounded_array (const unbounded_array &a)ContainerThe copy constructor.
~unbounded_array ()ContainerDeallocates the unbounded_array itself.
void resize (size_type n , bool preserve = true)StorageReallocates an unbounded_array to hold at most n elements. When preserve == false the elements values after resize are undefined.
void resize(size_type n, const T& t)StorageReallocates an unbounded_array to hold at most n elements. +
size_type size () constContainerReturns the size of the unbounded_array.
const_reference operator [] (size_type i) constContainerReturns a const reference of the i -th element.
reference operator [] (size_type i)ContainerReturns a reference of the i-th element.
unbounded_array &operator = (const unbounded_array &a)ContainerThe assignment operator.
unbounded_array &assign_temporary (unbounded_array &a)Assigns a temporary. May change the array a.
void swap (unbounded_array &a)ContainerSwaps the contents of the arrays.
const_iterator begin () constContainerReturns a const_iterator pointing to the beginning +of the unbounded_array.
const_iterator end () constContainerReturns a const_iterator pointing to the end of +the unbounded_array.
iterator begin ()ContainerReturns a iterator pointing to the beginning of +the unbounded_array.
iterator end ()ContainerReturns a iterator pointing to the end of the +unbounded_array.
const_reverse_iterator rbegin () constReversible ContainerReturns a const_reverse_iterator pointing to the beginning of the reversed unbounded_array.
const_reverse_iterator rend () constReversible ContainerReturns a const_reverse_iterator pointing to the end of the reversed unbounded_array.
reverse_iterator rbegin ()Reversible ContainerReturns a reverse_iterator pointing to the beginning of the reversed unbounded_array.
reverse_iterator rend ()Reversible ContainerReturns a reverse_iterator pointing to the end of the reversed unbounded_array.
+ + diff --git a/doc/vector.html b/doc/vector.html new file mode 100644 index 00000000..e69de29b