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 StorageThe 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
+#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;
+ }
+}
+
+Defined in the header storage.hpp.
+| Parameter | +Description | +Default | +
|---|---|---|
T |
+The type of object stored in the array. | ++ |
N |
+The allocation size of the array. | ++ |
ALLOC |
+An STL Allocator | +std::allocator | +
Random Access Container.
+None, except for those imposed by the requirements of Random Access Container.
+None.
+| Member | +Where defined | +Description | +
|---|---|---|
value_type | Container | |
pointer | Container | Currently defined as value_type* |
const_pointer | Currently defined as value_type* | |
reference | Container | Currently defined as value_type& |
const_reference | Container | Currently defined as const value_type& |
size_type | Container | Currently defined as Alloc::size_type |
difference_type | Container | Currently defined as Alloc::difference_type |
iterator | Container | Currently defined as pointer |
const_iterator | Container | Currently defined as const_pointer |
revere_iterator | Container | Currently defined as std::reverse_iterator<iterator> |
const_revere_iterator | Container | Currently 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) |
+Container | +The copy constructor. | +
~bounded_array () |
+Container | +Deallocates 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 () const |
+Container | +Returns the size of the bounded_array. |
+
const_reference operator [] (size_type i) const |
+Container | +Returns a const reference of the i -th element. |
+
reference operator [] (size_type i) |
+Container | +Returns a reference of the i-th element. |
+
bounded_array &operator = (const bounded_array &a) |
+Container | +The assignment operator. | +
bounded_array &assign_temporary (bounded_array &a) |
++ | Assigns a temporary. May change the array a. |
+
void swap (bounded_array &a) |
+Container | +Swaps the contents of the arrays. | +
const_iterator begin () const |
+Container | +Returns a const_iterator pointing to the beginning of the bounded_array. |
+
const_iterator end () const |
+Container | +Returns a const_iterator pointing to the end of the bounded_array. |
+
iterator begin () |
+Container | +Returns a iterator pointing to the beginning of the bounded_array. |
+
iterator end () |
+Container | +Returns a iterator pointing to the end of the bounded_array. |
+
const_reverse_iterator rbegin () const |
+Reversible Container | +Returns a const_reverse_iterator pointing to the beginning of the reversed bounded_array. |
+
const_reverse_iterator rend () const |
+Reversible Container | +Returns a const_reverse_iterator pointing to the end of the reversed bounded_array. |
+
reverse_iterator rbegin () |
+Reversible Container | +Returns a reverse_iterator pointing to the beginning of the reversed bounded_array. |
+
reverse_iterator rend () |
+Reversible Container | +Returns a reverse_iterator pointing to the end of the reversed bounded_array. |
+
+Container ConceptsA Vector describes common aspects of dense, packed and sparse +vectors.
++In addition to the types defined int + Vector Expression +
+| Storage | +array_type | +The type of underlying storage used to store the elements | +
V |
+A type that is a model of Vector | +
v |
+Objects of type V |
+
n, i |
+Objects of a type convertible to size_type |
+
t |
+Object of a type convertible to value_type |
+
p |
+Object of a type convertible to bool |
+
In addition to the expressions defined in Vector Expression the +following expressions must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Sizing constructor | +V v (n) |
++ | V |
+
| Element access [1] | +v[n] |
+n is convertible to size_type |
+reference if v is mutable, const_reference otherwise |
+
| Insert | +v.insert_element (i, t) |
+v is mutable. |
+void |
+
| Erase | +v.erase_element (i) |
+v is mutable. |
+void |
+
| Clear | +v.clear () |
+v is mutable. |
+void |
+
| Resize | +v.resize (n)+ v.resize (n, p) |
+v is mutable. |
+void |
+
| Storage | +data() const |
++ | const array_type& |
+
| Storage | +data() |
+v is mutable |
+array_type& |
+
Semantics of an expression is defined only where it differs +from, or is not defined in Vector Expression .
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Sizing constructor | +V v (n) |
+n >= 0 |
+Allocates a vector ofn elements. |
+v.size () == n. |
+
| Element access [1] | +v[n] |
+0<n>v.size() |
+returns the n-th element in v | ++ |
| Insert | +v.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. |
+
| Erase | +v.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
+(). |
+
| Clear | +v.clear () |
++ | Equivalent to + for (i = 0; i < v.size (); ++ i)+ v.erase (i); |
++ |
| Resize | +v.resize (n)
+ |
++ | 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. |
+
| Storage | +v.data() |
+v is const |
+Returns a reference to the underlying storage | ++ |
| Storage | +v.data() |
+v is mutable |
+Returns a reference to the underlying storage | ++ |
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.
+vector<T> , bounded_vector<T, N>unit_vector<T> , zero_vector<T> , scalar_vector<T>mapped_vector<T> , compressed_vector , coordinate_vectoroperator[] 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.
+A Matrix describes common aspects of dense, packed and sparse +matrices.
++See Matrix Expression +
+M |
+A type that is a model of Matrix | +
m |
+Objects of type M |
+
n1, n2, i, j |
+Objects of a type convertible to size_type |
+
t |
+Object of a type convertible to value_type |
+
p |
+Object of a type convertible to bool |
+
In addition to the expressions defined in Matrix Expression the +following expressions must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Sizing constructor | +M m (n1, n2) |
++ | M |
+
| Insert | +m.insert_element (i, j, t) |
+m is mutable. |
+void |
+
| Erase | +m.erase_element (i, j) |
+m is mutable. |
+void |
+
| Clear | +m.clear () |
+m is mutable. |
+void |
+
| Resize | +m.resize (n1, n2)+ m.resize (n1, n2, p) |
+m is mutable. |
+void |
+
Semantics of an expression is defined only where it differs +from, or is not defined in Matrix Expression .
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Sizing constructor | +M m (n1, n2) |
+n1 >= 0 and n2 >= 0 |
+Allocates a matrix of n1 rows and n2
+columns. |
+m.size1 () == n1 and m.size2 () ==
+n2. |
+
| Insert | +m.insert_element (i, j, t) |
+0 <= i < m.size1 (),+ 0 <= j < m.size2 ()and is equal to value_type (0). |
+A copy of t is inserted in m. |
+m (i, j) is a copy of t. |
+
| Erase | +m.erase (i, j) |
+0 <= i < m.size1 ()and |
+Destroys the element m (i, j) and replaces it with
+value_type (). |
+m (i, j) is a copy of value_type
+(). |
+
| Clear | +m.clear () |
++ | Equivalent to + for (i = 0; i < m.size1 (); ++ i)+ for (j = 0; j < m.size2 (); ++ j)+ m.erase (i, j); |
++ |
| Resize | +m.resize (n1, n2)
+ |
++ | 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. |
+
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.
+matrix<T> , bounded_matrix<T, M, N>identity_matrix<T> , zero_matrix<T> , scalar_matrix<T>triangular_matrix<T> , symmetric_matrix<T> , banded_matrix<T>mapped_matrix<T> , compressed_matrix , coordinate_matrixCopyright (©) 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 ConceptsA Vector describes common aspects of dense, packed and sparse +vectors.
++In addition to the types defined int + Vector Expression +
+| Storage | +array_type | +The type of underlying storage used to store the elements | +
V |
+A type that is a model of Vector | +
v |
+Objects of type V |
+
n, i |
+Objects of a type convertible to size_type |
+
t |
+Object of a type convertible to value_type |
+
p |
+Object of a type convertible to bool |
+
In addition to the expressions defined in Vector Expression the +following expressions must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Sizing constructor | +V v (n) |
++ | V |
+
| Element access [1] | +v[n] |
+n is convertible to size_type |
+reference if v is mutable, const_reference otherwise |
+
| Insert | +v.insert_element (i, t) |
+v is mutable. |
+void |
+
| Erase | +v.erase_element (i) |
+v is mutable. |
+void |
+
| Clear | +v.clear () |
+v is mutable. |
+void |
+
| Resize | +v.resize (n)+ v.resize (n, p) |
+v is mutable. |
+void |
+
| Storage | +data() const |
++ | const array_type& |
+
| Storage | +data() |
+v is mutable |
+array_type& |
+
Semantics of an expression is defined only where it differs +from, or is not defined in Vector Expression .
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Sizing constructor | +V v (n) |
+n >= 0 |
+Allocates a vector ofn elements. |
+v.size () == n. |
+
| Element access [1] | +v[n] |
+0<n>v.size() |
+returns the n-th element in v | ++ |
| Insert | +v.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. |
+
| Erase | +v.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
+(). |
+
| Clear | +v.clear () |
++ | Equivalent to + for (i = 0; i < v.size (); ++ i)+ v.erase (i); |
++ |
| Resize | +v.resize (n)
+ |
++ | 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. |
+
| Storage | +v.data() |
+v is const |
+Returns a reference to the underlying storage | ++ |
| Storage | +v.data() |
+v is mutable |
+Returns a reference to the underlying storage | ++ |
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.
+vector<T> , bounded_vector<T, N>unit_vector<T> , zero_vector<T> , scalar_vector<T>mapped_vector<T> , compressed_vector , coordinate_vectoroperator[] 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.
+A Matrix describes common aspects of dense, packed and sparse +matrices.
++See Matrix Expression +
+M |
+A type that is a model of Matrix | +
m |
+Objects of type M |
+
n1, n2, i, j |
+Objects of a type convertible to size_type |
+
t |
+Object of a type convertible to value_type |
+
p |
+Object of a type convertible to bool |
+
In addition to the expressions defined in Matrix Expression the +following expressions must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Sizing constructor | +M m (n1, n2) |
++ | M |
+
| Insert | +m.insert_element (i, j, t) |
+m is mutable. |
+void |
+
| Erase | +m.erase_element (i, j) |
+m is mutable. |
+void |
+
| Clear | +m.clear () |
+m is mutable. |
+void |
+
| Resize | +m.resize (n1, n2)+ m.resize (n1, n2, p) |
+m is mutable. |
+void |
+
Semantics of an expression is defined only where it differs +from, or is not defined in Matrix Expression .
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Sizing constructor | +M m (n1, n2) |
+n1 >= 0 and n2 >= 0 |
+Allocates a matrix of n1 rows and n2
+columns. |
+m.size1 () == n1 and m.size2 () ==
+n2. |
+
| Insert | +m.insert_element (i, j, t) |
+0 <= i < m.size1 (),+ 0 <= j < m.size2 ()and is equal to value_type (0). |
+A copy of t is inserted in m. |
+m (i, j) is a copy of t. |
+
| Erase | +m.erase (i, j) |
+0 <= i < m.size1 ()and |
+Destroys the element m (i, j) and replaces it with
+value_type (). |
+m (i, j) is a copy of value_type
+(). |
+
| Clear | +m.clear () |
++ | Equivalent to + for (i = 0; i < m.size1 (); ++ i)+ for (j = 0; j < m.size2 (); ++ j)+ m.erase (i, j); |
++ |
| Resize | +m.resize (n1, n2)
+ |
++ | 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. |
+
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.
+matrix<T> , bounded_matrix<T, M, N>identity_matrix<T> , zero_matrix<T> , scalar_matrix<T>triangular_matrix<T> , symmetric_matrix<T> , banded_matrix<T>mapped_matrix<T> , compressed_matrix , coordinate_matrixCopyright (©) 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 ConceptA dense-vector is a, exactly as the name says, a dense vector that is intended to behave well for linear algebra operations
+DefaultConstructible, RandomAccessContainer and Vector Expression[1].
+In addition to the types defined by RandomAccessContainer and Vector Expression
+| StorageArray | +array_type | +The type of underlying storage used to store the elements | +
V |
+A type that is a model of Vector | +
T |
+The value_type of elements of V | +
v |
+Objects of type V |
+
n, i |
+Objects of a type convertible to size_type |
+
t |
+Object of a type convertible to T |
+
p |
+Object of a type convertible to bool |
+
In addition to the expressions defined in DefaultConstructible and Vector Expression the following expressions must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Size-constructor | +V v(n) |
+T is DefaultConstructible | +V |
+
| Insert | +v.insert_element (i, t) |
+v is mutable. |
+void |
+
| Erase | +v.erase_element (i) |
+v is mutable. |
+void |
+
| Clear | +v.clear () |
+v is mutable. |
+void |
+
| Resize | +v.resize (n)+ v.resize (n, p) |
+v is mutable. |
+void |
+
| Storage | +data() const |
++ | const array_type& |
+
| Storage | +data() |
+v is mutable |
+array_type& |
+
Semantics of an expression is defined only where it differs +from, or is not defined in Vector Expression .
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Sizing constructor | +V v (n) |
+n >= 0 |
+Allocates a vector ofn elements. |
+v.size () == n. |
+
| Element access [1] | +v[n] |
+0<n>v.size() |
+returns the n-th element in v | ++ |
| Insert | +v.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. |
+
| Erase | +v.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
+(). |
+
| Clear | +v.clear () |
++ | Equivalent to + for (i = 0; i < v.size (); ++ i)+ v.erase (i); |
++ |
| Resize | +v.resize (n)
+ |
++ | 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. |
+
| Storage | +v.data() |
+v is const |
+Returns a reference to the underlying storage | ++ |
| Storage | +v.data() |
+v is mutable |
+Returns a reference to the underlying storage | ++ |
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.
+vector<T> , bounded_vector<T, N>unit_vector<T> , zero_vector<T> , scalar_vector<T>mapped_vector<T> , compressed_vector , coordinate_vector[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 ConceptA dense-vector is a, exactly as the name says, a dense vector that is intended to behave well for linear algebra operations
++In addition to the types defined int + Vector Expression +
+| Storage | +array_type | +The type of underlying storage used to store the elements | +
V |
+A type that is a model of Vector | +
v |
+Objects of type V |
+
n, i |
+Objects of a type convertible to size_type |
+
t |
+Object of a type convertible to value_type |
+
p |
+Object of a type convertible to bool |
+
In addition to the expressions defined in Vector Expression the +following expressions must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Sizing constructor | +V v (n) |
++ | V |
+
| Element access [1] | +v[n] |
+n is convertible to size_type |
+reference if v is mutable, const_reference otherwise |
+
| Insert | +v.insert_element (i, t) |
+v is mutable. |
+void |
+
| Erase | +v.erase_element (i) |
+v is mutable. |
+void |
+
| Clear | +v.clear () |
+v is mutable. |
+void |
+
| Resize | +v.resize (n)+ v.resize (n, p) |
+v is mutable. |
+void |
+
| Storage | +data() const |
++ | const array_type& |
+
| Storage | +data() |
+v is mutable |
+array_type& |
+
Semantics of an expression is defined only where it differs +from, or is not defined in Vector Expression .
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Sizing constructor | +V v (n) |
+n >= 0 |
+Allocates a vector ofn elements. |
+v.size () == n. |
+
| Element access [1] | +v[n] |
+0<n>v.size() |
+returns the n-th element in v | ++ |
| Insert | +v.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. |
+
| Erase | +v.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
+(). |
+
| Clear | +v.clear () |
++ | Equivalent to + for (i = 0; i < v.size (); ++ i)+ v.erase (i); |
++ |
| Resize | +v.resize (n)
+ |
++ | 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. |
+
| Storage | +v.data() |
+v is const |
+Returns a reference to the underlying storage | ++ |
| Storage | +v.data() |
+v is mutable |
+Returns a reference to the underlying storage | ++ |
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.
+vector<T> , bounded_vector<T, N>unit_vector<T> , zero_vector<T> , scalar_vector<T>mapped_vector<T> , compressed_vector , coordinate_vector[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 ConceptsA Scalar Expression is an expression convertible to a scalar +type.
+Default Constructible.
+| Value type | +value_type |
+The type of the scalar expression. | +
S |
+A type that is a model of Scalar Expression | +
In addition to the expressions defined in Default Constructible +the following expressions must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Evaluation | +operator value_type () const |
++ | value_type |
+
Semantics of an expression is defined only where it differs +from, or is not defined in Default Constructible.
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Evaluation | +operator value_type () const |
++ | Evaluates the scalar expression. | ++ |
The run-time complexity of the evaluation is specific for the +evaluated scalar expression.
+vector_scalar_unary<E, F>vector_scalar_binary<E1, E2, F>A Vector Expression is an expression evaluatable to a vector. +Vector Expression provides an Indexed Bidirectional +Iterator or an Indexed Random Access +Iterator .
+Default Constructible.
+| Value type | +value_type |
++The element type of the vector expression. + | +
| Reference type | +reference |
+
+The return type when accessing an element of a vector expression.
+ +Convertable to a value_type.
+ |
+
| Const reference type | +const_reference |
+
+The return type when accessing an element of a constant vector expression.
+ +Convertable to a value_type.
+ |
+
| Size type | +size_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 type | +difference_type |
++A signed integral type used to represent the distance between two of the vector expression's iterators. + | +
| Const iterator type | +const_iterator |
+A type of iterator that may be used to examine a vector +expression's elements. | +
| Iterator type | +iterator |
+A type of iterator that may be used to modify a vector +expression's elements. | +
| Const reverse iterator type | +const_reverse_iterator |
+A Reverse Iterator adaptor whose base iterator type is the +vector expression's const iterator type. | +
| Reverse iterator type | +reverse_iterator |
+A Reverse Iterator adaptor whose base iterator type is the +vector expression's iterator type. | +
V |
+A type that is a model of Vector Expression | +
v, v1, v2 |
+Object of type V |
+
i |
+Object of a type convertible to size_type |
+
t |
+Object of a type convertible to value_type |
+
In addition to the expressions defined in Default Constructible +the following expressions must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Beginning of range | +v.begin () |
++ | const_iterator |
+
v.begin () |
+v is mutable. |
+iterator |
+|
| End of range | +v.end () |
++ | const_iterator |
+
v.end () |
+v is mutable. |
+iterator |
+|
| Size | +v.size () |
++ | size_type |
+
| Swap | +v1.swap (v2) |
+v1 and v2 are mutable. |
+void |
+
| Beginning of reverse range | +v.rbegin () |
++ | const_reverse_iterator |
+
v.rbegin () |
+v is mutable. |
+reverse_iterator |
+|
| End of reverse range | +v.rend () |
++ | const_reverse_iterator |
+
v.rend () |
+v is mutable. |
+reverse_iterator |
+|
| Element access | +v (i) |
+i is convertible to size_type. |
+Convertible to value_type. |
+
| Assignment | +v2 = v1 |
+v2 is mutable and v1 is convertible
+to V. |
+V & |
+
v2.assign (v1) |
+v2 is mutable and v1 is convertible
+to V. |
+V & |
+|
| Computed assignment | +v2 += v1 |
+v2 is mutable and v1 is convertible
+to V. |
+V & |
+
v2.plus_assign (v1) |
+v2 is mutable and v1 is convertible
+to V. |
+V & |
+|
v2 -= v1 |
+v2 is mutable and v1 is convertible
+to V. |
+V & |
+|
v2.minus_assign (v1) |
+v2 is mutable and v1 is convertible
+to V. |
+V & |
+|
v *= t |
+v is mutable and t is convertible to
+value_type. |
+V & |
+
Semantics of an expression is defined only where it differs +from, or is not defined in Default Constructible.
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Beginning of range | +v.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 range | +v.end () |
++ | Returns an iterator pointing one past the last element in the +vector expression. | +v.end () is past-the-end. |
+
| Size | +v.size () |
++ | Returns the size of the vector expression, that is, its number +of elements. | +v.size () >= 0 |
+
| Swap | +v1.swap (v2) |
++ | Equivalent to swap (v1, v2). |
++ |
| Beginning of reverse range | +v.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 range | +v.rend () |
++ | Equivalent to reverse_iterator (v.begin ()). |
+v.rend () is past-the-end. |
+
| Element access | +v (i) |
+0 <= i < v.size () |
+Returns the i-th element of the vector
+expression. |
++ |
| Assignment | +v2 = v1 |
+v1.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 assignment | +v2 += v1 |
+v1.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 -= v1 |
+v1.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
+. |
++ |
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.
+| Valid range | +For any vector expression v, [v.begin (),
+v.end ()) is a valid range. |
+
| Completeness | +An 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 ranges | +The distance from v.begin () to v.end
+() is the same as the distance from v.rbegin ()
+to v.rend (). |
+
vector_range<V>vector_slice<V>matrix_row<M>matrix_column<M>matrix_vector_range<M>matrix_vector_slice<M>vector_unary<E, F>vector_binary<E1, E2, F>vector_binary_scalar1<E1, E2, F>vector_binary_scalar2<E1, E2, F>matrix_vector_unary1<E>matrix_vector_unary2<E>matrix_vector_binary1<E1, E2, F>matrix_vector_binary2<E1, E2, F>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 .
+Default Constructible.
+| Value type | +value_type |
++The element type of the matrix expression. + | +
| Reference type | +reference |
+
+The return type when accessing an element of a matrix expression.
+ +Convertable to a value_type.
+ |
+
| Const reference type | +const_reference |
+
+The return type when accessing an element of a constant matrix expression.
+ +Convertable to a value_type.
+ |
+
| Size type | +size_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 type | +difference_type |
++A signed integral type used to represent the distance between two of the matrix expression's iterators. + | +
| Const iterator types | +const_iterator1 |
+A type of column iterator that may be used to examine a matrix +expression's elements. | +
const_iterator2 |
+A type of row iterator that may be used to examine a matrix +expression's elements. | +|
| Iterator types | +iterator1 |
+A type of column iterator that may be used to modify a matrix +expression's elements. | +
iterator2 |
+A type of row iterator that may be used to modify a matrix +expression's elements. | +|
| Const reverse iterator types | +const_reverse_iterator1 |
+A Reverse Iterator adaptor whose base iterator type is the +matrix expression's const column iterator type. | +
const_reverse_iterator2 |
+A Reverse Iterator adaptor whose base iterator type is the +matrix expression's const row iterator type. | +|
| Reverse iterator types | +reverse_iterator1 |
+A Reverse Iterator adaptor whose base iterator type is the +matrix expression's column iterator type. | +
reverse_iterator2 |
+A Reverse Iterator adaptor whose base iterator type is the +matrix expression's row iterator type. | +
M |
+A type that is a model of Matrix Expression | +
m, m1, m2 |
+Object of type M |
+
i, j |
+Objects of a type convertible to size_type |
+
t |
+Object of a type convertible to value_type |
+
In addition to the expressions defined in Default Constructible +the following expressions must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Beginning of range | +m.begin1 () |
++ | const_iterator1 |
+
m.begin2 () |
++ | const_iterator2 |
+|
m.begin1 () |
+m is mutable. |
+iterator1 |
+|
m.begin2 () |
+m is mutable. |
+iterator2 |
+|
| End of range | +m.end1 () |
++ | const_iterator1 |
+
m.end2 () |
++ | const_iterator2 |
+|
m.end1 () |
+m is mutable. |
+iterator1 |
+|
m.end2 () |
+m is mutable. |
+iterator2 |
+|
| Size | +m.size1 () |
++ | size_type |
+
m.size2 () |
++ | size_type |
+|
| Swap | +m1.swap (m2) |
+m1 and m2 are mutable. |
+void |
+
| Beginning of reverse range | +m.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 range | +m.rend1 () |
++ | const_reverse_iterator1 |
+
m.rend2 () |
++ | const_reverse_iterator2 |
+|
m.rend1 () |
+m is mutable. |
+reverse_iterator1 |
+|
m.rend2 () |
+m is mutable. |
+reverse_iterator2 |
+|
| Element access | +m (i, j) |
+i and j are convertible to
+size_type . |
+Convertible to value_type. |
+
| Assignment | +m2 = m1 |
+m2 is mutable and m1 is convertible
+to M. |
+M & |
+
m2.assign (m1) |
+m2 is mutable and m1 is convertible
+to M. |
+M & |
+|
| Computed assignment | +m2 += m1 |
+m2 is mutable and m1 is convertible
+to M. |
+M & |
+
m2.plus_assign (m1) |
+m2 is mutable and m1 is convertible
+to M. |
+M & |
+|
m2 -= m1 |
+m2 is mutable and m1 is convertible
+to M. |
+M & |
+|
m2.minus_assign (m1) |
+m2 is mutable and m1 is convertible
+to M. |
+M & |
+|
m *= t |
+m is mutable and t is convertible to
+value_type. |
+M & |
+
Semantics of an expression is defined only where it differs +from, or is not defined in Default Constructible.
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Beginning of range | +m.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 range | +m.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. |
+|
| Size | +m.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 |
+|
| Swap | +m1.swap (m2) |
++ | Equivalent to swap (m1, m2). |
++ |
| Beginning of reverse range | +m.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 range | +m.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 access | +m (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. |
++ |
| Assignment | +m2 = m1 |
+m1.size1 () == m2.size1 () and |
+Assigns every element of the evaluated matrix expression
+m1 to the corresponding element of m2
+. |
++ |
m2.assign (m1) |
+m1.size1 () == m2.size1 () and |
+Assigns every element of m1 to the corresponding
+element of m2. |
++ | |
| Computed assignment | +m2 += m1 |
+m1.size1 () == m2.size1 () and |
+Adds every element of the evaluated matrix expression
+m1 to the corresponding element of
+m2. |
++ |
m2.plus_assign (m1) |
+m1.size1 () == m2.size1 () and |
+Adds every element of m1 to the corresponding
+element of m2. |
++ | |
m2 -= m1 |
+m1.size1 () == m2.size1 () and |
+Subtracts every element of the evaluated matrix expression
+m1 from the corresponding element of m2
+. |
++ | |
m2.minus_assign (m1) |
+m1.size1 () == m2.size1 () and |
+Subtracts every element of m1 from the
+corresponding element of m2. |
++ | |
m *= t |
++ | Multiplies every element of m with t
+. |
++ |
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.
+| Valid range | +For any matrix expression m, [m.begin1 (),
+m.end1 ()) and [m.begin2 (), m.end2 ()) are
+valid ranges. |
+
| Completeness | +An 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 ranges | +The 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
+(). |
+
matrix_range<M>matrix_slice<M>triangular_adaptor<M, F>symmetric_adaptor<M, F>banded_adaptor<M>vector_matrix_binary<E1, E2, F>matrix_unary1<E, F>matrix_unary2<E, F>matrix_binary<E1, E2, F>matrix_binary_scalar1<E1, E2, F>matrix_binary_scalar2<E1, E2, F>matrix_matrix_binary<E1, E2, F>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 ConceptsAn Iterator is a restricted pointer-like object pointing into a +vector or matrix container.
+An Indexed Bidirectional Iterator is an iterator of a container +that can be dereferenced, incremented, decremented and carries +index information.
+Assignable, Equality Comparable, Default Constructible.
+| Value type | +The type of the value obtained by dereferencing a Indexed +Bidirectional Iterator | +
| Container type | +The type of the container a Indexed Bidirectional Iterator +points into. | +
I |
+A type that is a model of Indexed Bidirectional Iterator | +
T |
+The value type of I |
+
C |
+The container type of I |
+
it, itt, it1, it2 |
+Objects of type I |
+
t |
+Object of type T |
+
c |
+Object of type C |
+
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.
+In addition to the expressions defined for Assignable, Equality +Comparable and Default Constructible, the following expressions +must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Default constructor | +I it |
++ | + |
| Dereference | +*it |
++ | Convertible to T. |
+
| Dereference assignment | +*it = t |
+I is mutable. |
++ |
| Member access | +it->m |
+T is a type for which t.m is
+defined. |
++ |
| Preincrement | +++ it |
++ | I & |
+
| Postincrement | +it ++ |
++ | I |
+
| Predecrement | +-- it |
++ | I & |
+
| Postdecrement | +it -- |
++ | I |
+
| Index | +it.index () |
++ | C::size_type |
+
Semantics of an expression is defined only where it differs +from, or is not defined in, Assignable, Equality Comparable and +Default Constructible.
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Default constructor | +I it |
++ | + | it is singular. |
+
| Dereference | +*it |
+it is dereferenceable. |
++ | + |
| Dereference assignment | +*it = t |
+Same as for *it. |
++ | *it is a copy of t. |
+
| Member access | +it->m |
+it is dereferenceable. |
+Equivalent to (*it).m |
++ |
| Preincrement | +++ it |
+it is dereferenceable. |
+it is modified to point to the next element. |
+it is dereferenceable or past-the-end.
+.+If it1 == it2,+then ++ it1 == ++ it2. |
+
| Postincrement | +it ++ |
+Same as for ++ it. |
+Equivalent to + { |
+it is dereferenceable or past-the-end. |
+
| Predecrement | +-- it |
+it 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. |
+
| Postdecrement | +it -- |
+Same as for -- it. |
+Equivalent to + { |
+it is dereferenceable. |
+
| Index | +it.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
+(). |
+
The complexity of operations on indexed bidirectional iterators +is guaranteed to be amortized constant time.
+| Identity | +it1 == it2 if and only if &*it1 ==
+&*it2. |
+
| Symmetry of increment and decrement | +If it is dereferenceable, then ++ it;
+--it; is a null operation. Similarly, -- it; ++
+it; is a null operation. |
+
| Relation between iterator index and container element +operator | +If it is dereferenceable, *it == it ()
+(it.index ()). |
+
sparse_vector<T>::iteratorAn Indexed Random Access Iterator is an iterator of a container +that can be dereferenced, moved forward, moved backward and carries +index information.
+LessThanComparable, Indexed Bidirectional +Iterator .
+| Value type | +The type of the value obtained by dereferencing a Indexed +Random Access Iterator | +
| Container type | +The type of the container a Indexed Random Access Iterator +points into. | +
I |
+A type that is a model of Indexed Random Access Iterator | +
T |
+The value type of I |
+
C |
+The container type of I |
+
it, itt, it1, it2 |
+Objects of type I |
+
t |
+Object of type T |
+
n |
+Object of type C::difference_type |
+
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.
In addition to the expressions defined for Indexed Bidirectional +Iterator , the following expressions must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Forward motion | +it += n |
++ | I & |
+
| Iterator addition | +it + n |
++ | I |
+
| Backward motion | +i -= n |
++ | I & |
+
| Iterator subtraction | +it - n |
++ | I |
+
| Difference | +it1 - it2 |
++ | C::difference_type |
+
| Element operator | +it [n] |
++ | Convertible to T. |
+
| Element assignment | +it [n] = t |
+I is mutable |
+Convertible to T. |
+
Semantics of an expression is defined only where it differs +from, or is not defined in, Indexed Bidirectional +Iterator .
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Forward motion | +it += n |
+Including 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 addition | +it + n |
+Same as for i += n. |
+Equivalent to + { |
+Result is dereferenceable or past-the-end. | +
| Backward motion | +it -= n |
+Including 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 subtraction | +it - n |
+Same as for i -= n. |
+Equivalent to + { |
+Result is dereferenceable or past-the-end. | +
| Difference | +it1 - it2 |
+Either it1 is reachable from it2 or
+it2 is reachable from it1, or both. |
+Returns a number n such that it1 == it2 +
+n |
++ |
| Element operator | +it [n] |
+it + n exists and is dereferenceable. |
+Equivalent to *(it + n) |
++ |
| Element assignment | +i[n] = t |
+Same as for it [n]. |
+Equivalent to *(it + n) = t |
++ |
The complexity of operations on indexed random access iterators +is guaranteed to be amortized constant time.
+| Symmetry of addition and subtraction | +If 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 addition | +If it1 - it2 is well-defined, then it1 ==
+it2 + (it1 - it2). |
+
| Reachability and distance | +If it1 is reachable from it2, then
+it1 - it2 >= 0. |
+
vector<T>::iteratorAn Indexed Bidirectional Column/Row Iterator is an iterator of a +container that can be dereferenced, incremented, decremented and +carries index information.
+Assignable, Equality Comparable, Default Constructible.
+| Value type | +The type of the value obtained by dereferencing a Indexed +Bidirectional Column/Row Iterator | +
| Container type | +The type of the container a Indexed Bidirectional Column/Row +Iterator points into. | +
I1 |
+A type that is a model of Indexed Bidirectional Column/Row +Iterator | +
I2 |
+A type that is a model of Indexed Bidirectional Row/Column +Iterator | +
T |
+The value type of I1 and I2 |
+
C |
+The container type of I1 and I2 |
+
it1, it1t, it11,
+it12 |
+Objects of type I1 |
+
it2, it2t |
+Objects of type I2 |
+
t |
+Object of type T |
+
c |
+Object of type C |
+
In addition to the expressions defined for Assignable, Equality +Comparable and Default Constructible, the following expressions +must be valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Default constructor | +I1 it1 |
++ | + |
| Dereference | +*it1 |
++ | Convertible to T. |
+
| Dereference assignment | +*it1 = t |
+I1 is mutable. |
++ |
| Member access | +it1->m |
+T is a type for which t.m is
+defined. |
++ |
| Preincrement | +++ it1 |
++ | I1 & |
+
| Postincrement | +it1 ++ |
++ | I1 |
+
| Predecrement | +-- it1 |
++ | I1 & |
+
| Postdecrement | +it1 -- |
++ | I1 |
+
| Row Index | +it1.index1 () |
++ | C::size_type |
+
| Column Index | +it1.index2 () |
++ | C::size_type |
+
| Row/Column Begin | +it1.begin () |
++ | I2 |
+
| Row/Column End | +it1.end () |
++ | I2 |
+
| Reverse Row/Column Begin | +it1.rbegin () |
++ | reverse_iterator<I2> |
+
| Reverse Row/Column End | +it1.rend () |
++ | reverse_iterator<I2> |
+
Semantics of an expression is defined only where it differs +from, or is not defined in, Assignable, Equality Comparable and +Default Constructible.
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Default constructor | +I1 it1 |
++ | + | it1 is singular. |
+
| Dereference | +*it1 |
+it1 is dereferenceable. |
++ | + |
| Dereference assignment | +*it1 = t |
+Same as for *it1. |
++ | *it1 is a copy of t. |
+
| Member access | +it1->m |
+it1 is dereferenceable. |
+Equivalent to (*it1).m |
++ |
| Preincrement | +++ it1 |
+it1 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.
+.+If it11 == it12,+then ++ it11 == ++ it12. |
+
| Postincrement | +it1 ++ |
+Same as for ++ it1. |
+Equivalent to + { |
+it1 is dereferenceable or past-the-end. |
+
| Predecrement | +-- it1 |
+it1 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. |
+
| Postdecrement | +it1 -- |
+Same as for -- it1. |
+Equivalent to + { |
+it1 is dereferenceable. |
+
| Row Index | +it1.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 Index | +it1.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 Begin | +it1.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 |
++ |
| Row/Column End | +it1.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 |
++ |
| Reverse Row/Column Begin | +it1.rbegin () |
+it1 is dereferenceable. |
+Equivalent to reverse_iterator<I2> (it1.end
+()). |
++ |
| Reverse Row/Column End | +it1.rend () |
+it1 is dereferenceable. |
+Equivalent to reverse_iterator<I2> (it1.begin
+()). |
++ |
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.
+| Identity | +it11 == it12 if and only if &*it11 ==
+&*it12. |
+
| Symmetry of increment and decrement | +If it1 is dereferenceable, then ++ it1;
+--it1; is a null operation. Similarly, -- it1; ++
+it1; is a null operation. |
+
| Relation between iterator index and container element +operator | +If it1 is dereferenceable, *it1 == it1 ()
+(it1.index1 (), it2.index2 ()) |
+
| Relation between iterator column/row begin and iterator +index | +If 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 |
+
| Relation between iterator column/row end and iterator +index | +If 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 |
+
sparse_matrix<T>::iterator1sparse_matrix<T>::iterator2An Indexed Random Access Column/Row Iterator is an iterator of a +container that can be dereferenced, incremented, decremented and +carries index information.
+Indexed +Bidirectional Column/Row Iterator .
+| Value type | +The type of the value obtained by dereferencing a Indexed +Random Access Column/Row Iterator | +
| Container type | +The type of the container a Indexed Random Access Column/Row +Iterator points into. | +
I |
+A type that is a model of Indexed Random Access Column/Row +Iterator | +
T |
+The value type of I |
+
C |
+The container type of I |
+
it, itt, it1, it2 |
+Objects of type I |
+
t |
+Object of type T |
+
c |
+Object of type C |
+
In addition to the expressions defined for Indexed Bidirectional +Column/Row Iterator , the following expressions must be +valid.
+| Name | +Expression | +Type requirements | +Return type | +
|---|---|---|---|
| Forward motion | +it += n |
++ | I & |
+
| Iterator addition | +it + n |
++ | I |
+
| Backward motion | +i -= n |
++ | I & |
+
| Iterator subtraction | +it - n |
++ | I |
+
| Difference | +it1 - it2 |
++ | C::difference_type |
+
| Element operator | +it [n] |
++ | Convertible to T. |
+
| Element assignment | +it [n] = t |
+I is mutable |
+Convertible to T. |
+
Semantics of an expression is defined only where it differs +from, or is not defined in, Indexed Bidirectional +Column/Row Iterator .
+| Name | +Expression | +Precondition | +Semantics | +Postcondition | +
|---|---|---|---|---|
| Forward motion | +it += n |
+Including 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 addition | +it + n |
+Same as for i += n. |
+Equivalent to + { |
+Result is dereferenceable or past-the-end. | +
| Backward motion | +it -= n |
+Including 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 subtraction | +it - n |
+Same as for i -= n. |
+Equivalent to + { |
+Result is dereferenceable or past-the-end. | +
| Difference | +it1 - it2 |
+Either it1 is reachable from it2 or
+it2 is reachable from it1, or both. |
+Returns a number n such that it1 == it2 +
+n |
++ |
| Element operator | +it [n] |
+it + n exists and is dereferenceable. |
+Equivalent to *(it + n) |
++ |
| Element assignment | +i[n] = t |
+Same as for it [n]. |
+Equivalent to *(it + n) = t |
++ |
The complexity of operations on indexed random access Column/Row +iterators is guaranteed to be amortized constant time.
+| Symmetry of addition and subtraction | +If 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 addition | +If it1 - it2 is well-defined, then it1 ==
+it2 + (it1 - it2). |
+
| Reachability and distance | +If it1 is reachable from it2, then
+it1 - it2 >= 0. |
+
matrix<T>::iterator1matrix<T>::iterator2Copyright (©) 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 StorageThe 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.
+#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;
+ }
+}
+
+Defined in the header storage.hpp.
+Reversible Container.
+None, except for those imposed by the requirements of Reversible +Container.
+None.
+| Member | +Description | +
|---|---|
range (size_type start, size_type stop) |
+Constructs a range of indicies from start to stop (excluded)
+. |
+
size_type start () const |
+Returns the beginning of the range. |
+
size_type size () const |
+Returns the size of the range. |
+
const_reference operator [] (size_type i)
+const |
+Returns the value start + i of the i
+-th element. |
+
range compose (const range &r) const |
+Returns the composite range from start + r.start
+() to start + r.start () + r.size (). |
+
bool operator == (const range &r) const |
+Tests two ranges for equality. | +
bool operator != (const range &r) const |
+Tests two ranges for inequality. | +
const_iterator begin () const |
+Returns a const_iterator pointing to the beginning
+of the range. |
+
const_iterator end () const |
+Returns a const_iterator pointing to the end of
+the range. |
+
const_reverse_iterator rbegin () const |
+Returns a const_reverse_iterator pointing to the
+beginning of the reversed range. |
+
const_reverse_iterator rend () const |
+Returns a const_reverse_iterator pointing to the
+end of the reversed range. |
+
start () <= stop ()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.
+#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;
+ }
+}
+
+Defined in the header storage.hpp.
+Reversible Container.
+None, except for those imposed by the requirements of Reversible +Container.
+None.
+| Member | +Description | +
|---|---|
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 () const |
+Returns the beginning of the slice. |
+
size_type stride () const |
+Returns the stride of the slice. |
+
size_type size () const |
+Returns the size of the slice. |
+
const_reference operator [] (size_type i)
+const |
+Returns the value start + i * stride of the
+i-th element. |
+
slice compose (const range &r) const |
+Returns the composite slice from start + stride * r.start
+() to start + stride * (r.start () + r.size ())
+with stride stride. |
+
slice compose (const slice &s) const |
+Returns 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) const |
+Tests two slices for equality. | +
bool operator != (const slice &s) const |
+Tests two slices for inequality. | +
const_iterator begin () const |
+Returns a const_iterator pointing to the beginning
+of the slice. |
+
const_iterator end () const |
+Returns a const_iterator pointing to the end of
+the slice. |
+
const_reverse_iterator rbegin () const |
+Returns a const_reverse_iterator pointing to the
+beginning of the reversed slice. |
+
const_reverse_iterator rend () const |
+Returns a const_reverse_iterator pointing to the
+end of the reversed slice. |
+
+Storage conceptStorage 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. +
| X | A type that is model of Storage |
| T | The value_type of X |
| t | An object of type T |
| n | object of type convertible to X::size_type |
| Name | Expression | Type requirements | Return type |
|---|---|---|---|
| Size constructor | +X(n) | +T is DefaultConstructible | +X | +
| Fill constructor | +X(n,t) | ++ | X | +
| Range constructor | +X(i, j) | +i and j are Input Iterators whose value type is convertible to T | +X | +
| Resize | +a.resize(n, t) | +a is mutable | +void | +
| Resize | +a.resize(n) | +a is mutable | +void | +
| Name | Expression | Precondition | Semantics | Postcondition + |
|---|---|---|---|---|
| Default-constructor | +X() + | + | Creates 0 elements. + | +size()==0 | +
| Size-constructor | +X(n) + | n>=0 | +Creates 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-constructor | +X(n,t) + | n>=0 | +Creates n initialised element with copies of t |
+size()==n | +
| Range constructor | +X(i, j) | +[i,j) is a valid range. | +copies the range [i,j) to the storage | +size() is equal to the distance from i to j. Each element is a copy of the corresponding element in the range [i,j). | +
| Resize | +a.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 | +
| Resize | +a.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 | +
+VectorThe 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.
+#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;
+}
+
+Defined in the header vector.hpp.
+| Parameter | +Description | +Default | +
|---|---|---|
T |
+The type of object stored in the vector. | ++ |
A |
+The type of the adapted array. [1] | +unbounded_array<T> |
+
Vector .
+None, except for those imposed by the requirements of Vector .
+vector_expression<vector<T, A> >
| Member | +Where defined | +Description | +
|---|---|---|
value_type |
+VectorExpression | ++ |
reference |
+VectorExpression | ++ |
const_reference |
+VectorExpression | ++ |
size_type |
+VectorExpression | ++ |
difference_type |
+VectorExpression | ++ |
const_iterator |
+VectorExpression | ++ |
iterator |
+VectorExpression | ++ |
const_reverse_iterator |
+VectorExpression | ++ |
reverse_iterator |
+VectorExpression | ++ |
array_type |
+Vector | ++ |
vector () |
+VectorExpression | +Allocates an uninitialized vector that holds zero
+elements. |
+
vector (size_type size) |
+Vector | +Allocates an uninitialized vector that holds
+size elements. |
+
vector (const vector &v) |
++ | The copy constructor. | +
template<class AE> |
++ | The extended copy constructor. | +
void resize (size_type size, bool preserve =
+true) |
+Vector | +Reallocates a vector to hold size
+elements. The existing elements of the vector are
+preseved when specified. |
+
size_type size () const |
+VectorExpression | +Returns the size of the vector. |
+
const array_type& data () const |
+Vector | ++ |
array_type& data () |
+Vector | ++ |
const_reference operator () (size_type i)
+const |
+VectorExpression | +Returns a const reference of the i
+-th element. |
+
reference operator () (size_type i) |
+VectorExpression | +Returns a reference of the i-th element. |
+
const_reference operator [] (size_type i)
+const |
+Vector | +Returns a const reference of the i
+-th element. |
+
reference operator [] (size_type i) |
+Vector | +Returns a reference of the i-th element. |
+
vector &operator = (const vector &v) |
+VectorExpression | +The assignment operator. | +
vector &assign_temporary (vector &v) |
+VectorExpression | +Assigns a temporary. May change the vector v. |
+
template<class AE> |
+VectorExpression | +The extended assignment operator. | +
template<class AE> |
+VectorExpression | +Assigns a vector expression to the vector. Left and right hand +side of the assignment should be independent. | +
template<class AE> |
+VectorExpression | +A computed assignment operator. Adds the vector expression to +the vector. | +
template<class AE> |
+VectorExpression | +Adds a vector expression to the vector. Left and right hand +side of the assignment should be independent. | +
template<class AE> |
+VectorExpression | +A computed assignment operator. Subtracts the vector expression +from the vector. | +
template<class AE> |
+VectorExpression | +Subtracts a vector expression from the vector. Left and right +hand side of the assignment should be independent. | +
template<class AT> |
+VectorExpression | +A computed assignment operator. Multiplies the vector with a +scalar. | +
template<class AT> |
+VectorExpression | +A computed assignment operator. Divides the vector through a +scalar. | +
void swap (vector &v) |
+VectorExpression | +Swaps the contents of the vectors. | +
void insert (size_type i, const_reference t) |
+Vector | +Inserts the value t at the i-th
+element. |
+
void erase (size_type i) |
+Vector | +Erases the value at the i-th element. |
+
void clear () |
+Vector | +Clears the vector. | +
const_iterator begin () const |
+VectorExpression | +Returns a const_iterator pointing to the beginning
+of the vector. |
+
const_iterator end () const |
+VectorExpression | +Returns a const_iterator pointing to the end of
+the vector. |
+
iterator begin () |
+VectorExpression | +Returns a iterator pointing to the beginning of
+the vector. |
+
iterator end () |
+VectorExpression | +Returns a iterator pointing to the end of the
+vector. |
+
const_reverse_iterator rbegin () const |
+VectorExpression | +Returns a const_reverse_iterator pointing to the
+beginning of the reversed vector. |
+
const_reverse_iterator rend () const |
+VectorExpression | +Returns a const_reverse_iterator pointing to the
+end of the reversed vector. |
+
reverse_iterator rbegin () |
+VectorExpression | +Returns a reverse_iterator pointing to the
+beginning of the reversed vector. |
+
reverse_iterator rend () |
+VectorExpression | +Returns a reverse_iterator pointing to the end of
+the reversed vector. |
+
[1] Supported parameters
+for the adapted array are unbounded_array<T> ,
+bounded_array<T> and
+std::vector<T> .
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.
+#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;
+ }
+}
+
+Defined in the header vector.hpp.
+| Parameter | +Description | +Default | +
|---|---|---|
T |
+The type of object stored in the vector. | ++ |
None, except for those imposed by the requirements of Vector Expression +.
+vector_expression<unit_vector<T> >
| Member | +Description | +
|---|---|
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 () const |
+Returns the size of the unit_vector. |
+
size_type index () const |
+Returns the index of the unit_vector. |
+
const_reference operator () (size_type i)
+const |
+Returns the value of the i-th element. |
+
const_reference operator [] (size_type i)
+const |
+Returns 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 () const |
+Returns a const_iterator pointing to the beginning
+of the unit_vector. |
+
const_iterator end () const |
+Returns a const_iterator pointing to the end of
+the unit_vector. |
+
const_reverse_iterator rbegin () const |
+Returns a const_reverse_iterator pointing to the
+beginning of the reversed unit_vector. |
+
const_reverse_iterator rend () const |
+Returns a const_reverse_iterator pointing to the
+end of the reversed unit_vector. |
+
The templated class zero_vector<T> represents
+zero vectors. For a n-dimensional zero vector and 0
+<= i < n holds zi =
+0.
+#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;
+}
+
+Defined in the header vector.hpp.
+| Parameter | +Description | +Default | +
|---|---|---|
T |
+The type of object stored in the vector. | ++ |
None, except for those imposed by the requirements of Vector Expression +.
+vector_expression<zero_vector<T> >
| Member | +Description | +
|---|---|
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 () const |
+Returns the size of the zero_vector. |
+
const_reference operator () (size_type i)
+const |
+Returns the value of the i-th element. |
+
const_reference operator [] (size_type i)
+const |
+Returns 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 () const |
+Returns a const_iterator pointing to the beginning
+of the zero_vector. |
+
const_iterator end () const |
+Returns a const_iterator pointing to the end of
+the zero_vector. |
+
const_reverse_iterator rbegin () const |
+Returns a const_reverse_iterator pointing to the
+beginning of the reversed zero_vector. |
+
const_reverse_iterator rend () const |
+Returns a const_reverse_iterator pointing to the
+end of the reversed zero_vector. |
+
The templated class scalar_vector<T>
+represents scalar vectors. For a n-dimensional scalar
+vector and 0 <= i < n holds
+zi = s.
+#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;
+}
+
+Defined in the header vector.hpp.
+| Parameter | +Description | +Default | +
|---|---|---|
T |
+The type of object stored in the vector. | ++ |
None, except for those imposed by the requirements of Vector Expression +.
+vector_expression<scalar_vector<T>
+>
| Member | +Description | +
|---|---|
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 () const |
+Returns the size of the scalar_vector. |
+
const_reference operator () (size_type i)
+const |
+Returns the value of the i-th element. |
+
const_reference operator [] (size_type i)
+const |
+Returns 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 () const |
+Returns a const_iterator pointing to the beginning
+of the scalar_vector. |
+
const_iterator end () const |
+Returns a const_iterator pointing to the end of
+the scalar_vector. |
+
const_reverse_iterator rbegin () const |
+Returns a const_reverse_iterator pointing to the
+beginning of the reversed scalar_vector. |
+
const_reverse_iterator rend () const |
+Returns 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 StorageThe 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
+#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;
+ }
+}
+
+Defined in the header storage.hpp.
+| Parameter | +Description | +Default | +
|---|---|---|
T |
+The type of object stored in the array. | ++ |
ALLOC |
+An STL Allocator | +std::allocator | +
None, except for those imposed by the requirements of Random +Access Container.
+None.
+| Member | +Where defined | +Description | +
|---|---|---|
value_type | Container | |
pointer | Container | Currently defined as value_type* |
const_pointer | Currently defined as value_type* | |
reference | Container | Currently defined as value_type& |
const_reference | Container | Currently defined as const value_type& |
size_type | Container | Currently defined as Alloc::size_type |
difference_type | Container | Currently defined as Alloc::difference_type |
iterator | Container | Currently defined as pointer |
const_iterator | Container | Currently defined as const_pointer |
revere_iterator | Container | Currently defined as std::reverse_iterator<iterator> |
const_revere_iterator | Container | Currently defined as std::reverse_iterator<const_iterator> |
allocator_type | Defined as ALLOC | |
explicit unbounded_array (ALLOC &a = ALLOC()) |
+Storage | +Creates an unbounded_array that holds at most zero elements, using a specified allocator. |
+
explicit unbounded_array (size_type size, ALLOC &a = ALLOC()) |
+Storage | +Creates 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()) |
+Storage | +Creates 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) |
+Container | +The copy constructor. | +
~unbounded_array () |
+Container | +Deallocates the unbounded_array itself. |
+
void resize (size_type n , bool preserve = true) |
+Storage | +Reallocates 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) |
+Storage | +Reallocates an unbounded_array to hold at most n elements.
+ |
size_type size () const |
+Container | +Returns the size of the unbounded_array. |
+
const_reference operator [] (size_type i) const |
+Container | +Returns a const reference of the i -th element. |
+
reference operator [] (size_type i) |
+Container | +Returns a reference of the i-th element. |
+
unbounded_array &operator = (const unbounded_array &a) |
+Container | +The assignment operator. | +
unbounded_array &assign_temporary (unbounded_array &a) |
++ | Assigns a temporary. May change the array a. |
+
void swap (unbounded_array &a) |
+Container | +Swaps the contents of the arrays. | +
const_iterator begin () const |
+Container | +Returns a const_iterator pointing to the beginning
+of the unbounded_array. |
+
const_iterator end () const |
+Container | +Returns a const_iterator pointing to the end of
+the unbounded_array. |
+
iterator begin () |
+Container | +Returns a iterator pointing to the beginning of
+the unbounded_array. |
+
iterator end () |
+Container | +Returns a iterator pointing to the end of the
+unbounded_array. |
+
const_reverse_iterator rbegin () const |
+Reversible Container | +Returns a const_reverse_iterator pointing to the beginning of the reversed unbounded_array. |
+
const_reverse_iterator rend () const |
+Reversible Container | +Returns a const_reverse_iterator pointing to the end of the reversed unbounded_array. |
+
reverse_iterator rbegin () |
+Reversible Container | +Returns a reverse_iterator pointing to the beginning of the reversed unbounded_array. |
+
reverse_iterator rend () |
+Reversible Container | +Returns a reverse_iterator pointing to the end of the reversed unbounded_array. |
+