From 4ab34dbb6e32efbb19cbfaae1f10027d79c233b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Walter?= Date: Tue, 4 Feb 2003 07:22:11 +0000 Subject: [PATCH] Documentation update and some fixes. [SVN r17184] --- doc/banded.htm | 1732 +++----- doc/container.htm | 703 +-- doc/expression.htm | 1932 +++++---- doc/hermitian.htm | 1741 +++----- doc/index.htm | 682 +-- doc/iterator.htm | 2509 +++++------ doc/matrix.htm | 1758 +++----- doc/matrix_expression.htm | 3822 +++++----------- doc/matrix_proxy.htm | 3840 ++++++----------- doc/matrix_sparse.htm | 2798 ++++-------- doc/overview.htm | 3190 +++++++------- doc/readme.txt | 15 +- doc/samples/Jamfile | 365 ++ doc/samples/banded_adaptor.cpp | 13 + doc/samples/banded_matrix.cpp | 12 + doc/samples/bounded_array.cpp | 11 + doc/samples/compressed_matrix.cpp | 12 + doc/samples/compressed_vector.cpp | 11 + doc/samples/coordinate_matrix.cpp | 12 + doc/samples/coordinate_vector.cpp | 11 + doc/samples/hermitian_adaptor.cpp | 22 + doc/samples/hermitian_matrix.cpp | 21 + doc/samples/identity_matrix.cpp | 9 + doc/samples/map_array.cpp | 11 + doc/samples/matrix.cpp | 12 + doc/samples/matrix_binary.cpp | 14 + doc/samples/matrix_binary_scalar.cpp | 14 + doc/samples/matrix_column.cpp | 14 + doc/samples/matrix_column_project.cpp | 13 + doc/samples/matrix_matrix_binary.cpp | 13 + doc/samples/matrix_matrix_solve.cpp | 13 + doc/samples/matrix_range.cpp | 13 + doc/samples/matrix_range_project.cpp | 12 + doc/samples/matrix_row.cpp | 14 + doc/samples/matrix_row_project.cpp | 13 + doc/samples/matrix_slice.cpp | 13 + doc/samples/matrix_slice_project.cpp | 12 + doc/samples/matrix_unary.cpp | 18 + doc/samples/matrix_vector_binary.cpp | 17 + doc/samples/matrix_vector_range.cpp | 14 + doc/samples/matrix_vector_slice.cpp | 14 + doc/samples/matrix_vector_solve.cpp | 17 + doc/samples/range.cpp | 10 + doc/samples/slice.cpp | 10 + doc/samples/sparse_matrix.cpp | 12 + doc/samples/sparse_vector.cpp | 11 + doc/samples/symmetric_adaptor.cpp | 18 + doc/samples/symmetric_matrix.cpp | 17 + doc/samples/triangular_adaptor.cpp | 18 + doc/samples/triangular_matrix.cpp | 17 + doc/samples/unbounded_array.cpp | 11 + doc/samples/unit_vector.cpp | 11 + doc/samples/vector.cpp | 11 + doc/samples/vector_binary.cpp | 13 + doc/samples/vector_binary_outer.cpp | 12 + doc/samples/vector_binary_redux.cpp | 11 + doc/samples/vector_binary_scalar.cpp | 13 + doc/samples/vector_range.cpp | 12 + doc/samples/vector_range_project.cpp | 11 + doc/samples/vector_slice.cpp | 12 + doc/samples/vector_slice_project.cpp | 11 + doc/samples/vector_unary.cpp | 17 + doc/samples/vector_unary_redux.cpp | 15 + doc/samples/zero_matrix.cpp | 9 + doc/samples/zero_vector.cpp | 9 + doc/storage.htm | 896 ++-- doc/storage_sparse.htm | 481 +-- doc/symmetric.htm | 1732 +++----- doc/triangular.htm | 1753 +++----- doc/vector.htm | 1325 ++---- doc/vector_expression.htm | 2394 ++++------ doc/vector_proxy.htm | 1237 ++---- doc/vector_sparse.htm | 2056 ++++----- include/boost/numeric/ublas/config.hpp | 10 +- include/boost/numeric/ublas/traits.hpp | 12 +- include/boost/numeric/ublas/triangular.hpp | 30 +- .../boost/numeric/ublas/vector_expression.hpp | 2 +- 77 files changed, 14864 insertions(+), 22837 deletions(-) create mode 100644 doc/samples/Jamfile create mode 100644 doc/samples/banded_adaptor.cpp create mode 100644 doc/samples/banded_matrix.cpp create mode 100644 doc/samples/bounded_array.cpp create mode 100644 doc/samples/compressed_matrix.cpp create mode 100644 doc/samples/compressed_vector.cpp create mode 100644 doc/samples/coordinate_matrix.cpp create mode 100644 doc/samples/coordinate_vector.cpp create mode 100644 doc/samples/hermitian_adaptor.cpp create mode 100644 doc/samples/hermitian_matrix.cpp create mode 100644 doc/samples/identity_matrix.cpp create mode 100644 doc/samples/map_array.cpp create mode 100644 doc/samples/matrix.cpp create mode 100644 doc/samples/matrix_binary.cpp create mode 100644 doc/samples/matrix_binary_scalar.cpp create mode 100644 doc/samples/matrix_column.cpp create mode 100644 doc/samples/matrix_column_project.cpp create mode 100644 doc/samples/matrix_matrix_binary.cpp create mode 100644 doc/samples/matrix_matrix_solve.cpp create mode 100644 doc/samples/matrix_range.cpp create mode 100644 doc/samples/matrix_range_project.cpp create mode 100644 doc/samples/matrix_row.cpp create mode 100644 doc/samples/matrix_row_project.cpp create mode 100644 doc/samples/matrix_slice.cpp create mode 100644 doc/samples/matrix_slice_project.cpp create mode 100644 doc/samples/matrix_unary.cpp create mode 100644 doc/samples/matrix_vector_binary.cpp create mode 100644 doc/samples/matrix_vector_range.cpp create mode 100644 doc/samples/matrix_vector_slice.cpp create mode 100644 doc/samples/matrix_vector_solve.cpp create mode 100644 doc/samples/range.cpp create mode 100644 doc/samples/slice.cpp create mode 100644 doc/samples/sparse_matrix.cpp create mode 100644 doc/samples/sparse_vector.cpp create mode 100644 doc/samples/symmetric_adaptor.cpp create mode 100644 doc/samples/symmetric_matrix.cpp create mode 100644 doc/samples/triangular_adaptor.cpp create mode 100644 doc/samples/triangular_matrix.cpp create mode 100644 doc/samples/unbounded_array.cpp create mode 100644 doc/samples/unit_vector.cpp create mode 100644 doc/samples/vector.cpp create mode 100644 doc/samples/vector_binary.cpp create mode 100644 doc/samples/vector_binary_outer.cpp create mode 100644 doc/samples/vector_binary_redux.cpp create mode 100644 doc/samples/vector_binary_scalar.cpp create mode 100644 doc/samples/vector_range.cpp create mode 100644 doc/samples/vector_range_project.cpp create mode 100644 doc/samples/vector_slice.cpp create mode 100644 doc/samples/vector_slice_project.cpp create mode 100644 doc/samples/vector_unary.cpp create mode 100644 doc/samples/vector_unary_redux.cpp create mode 100644 doc/samples/zero_matrix.cpp create mode 100644 doc/samples/zero_vector.cpp diff --git a/doc/banded.htm b/doc/banded.htm index 84581ae4..32cc9ead 100644 --- a/doc/banded.htm +++ b/doc/banded.htm @@ -1,1206 +1,604 @@ + - - - -Banded Matrix + + + + + Banded Matrix - - - -

c++boost.gifBanded Matrix

- -

Banded Matrix

- + + +

c++boost.gif +Banded Matrix

+ +

+Banded Matrix

+

Description

- -

The templated class banded_matrix<T, F, A> is -the base container adaptor for banded matrices. For a (m x n)-dimensional -banded matrix with l lower and u upper -diagonals and 0 <= i < m, 0 <= j < n -holds bi, j = 0, if i -> j + l or i < j - u. The storage of banded -matrices is packed.

- + +

The templated class banded_matrix<T, F, A> is the base +container adaptor for banded matrices. For a (m x n)-dimensional +banded matrix with l lower and u upper diagonals and +0 <= i < m, 0 <= j < n holds b +i, j = 0, if i > j + l or i < j - +u. The storage of banded matrices is packed.

+

Example

- -
int main () {
-    using namespace boost::numeric::ublas;
-    banded_matrix<double> m (3, 3, 1, 1);
-    for (int i = 0; i < m.size1 (); ++ i)
-        for (int j = std::max (i - 1, 0); j < std::min (i + 2, m.size2 ()); ++ j)
-            m (i, j) = 3 * i + j;
-    std::cout << m << std::endl;
-}
- + +
#include <boost/numeric/ublas/banded.hpp>
#include <boost/numeric/ublas/io.hpp>

int main () {
using namespace boost::numeric::ublas;
banded_matrix<double> m (3, 3, 1, 1);
for (signed i = 0; i < signed (m.size1 ()); ++ i)
for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (m.size2 ())); ++ j)
m (i, j) = 3 * i + j;
std::cout << m << std::endl;
}

Definition

- +

Defined in the header banded.hpp.

- +

Template parameters

- + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
Parameter Description Default
T The type of object stored in the matrix. 
FFunctor describing the storage organization. [1]row_major
AThe type of the adapted array. [2]unbounded_array<T>
Parameter Description Default
T The type of object stored in the matrix. 
FFunctor describing the storage organization. +[1] + row_major
AThe type of the adapted array. [2] + unbounded_array<T>
- +

Model of

- -

Matrix.

- + +

Matrix +.

+

Type requirements

- -

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

- + +

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

+

Public base classes

- -

matrix_expression<banded_matrix<T, F, A> > -

- + +

matrix_expression<banded_matrix<T, F, A> >

+

Members

- + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Member Description
banded_matrix () Allocates an uninitialized banded_matrix - that holds zero rows of zero elements.
banded_matrix (size_type size1, size_type - size2, size_type lower = 0, size_type upper = 0)Allocates an uninitialized banded_matrix - that holds (lower + 1 + upper) diagonals - around the main diagonal of a matrix with size1 - rows of size2 elements.
banded_matrix (const banded_matrix &m)The copy constructor.
template<class AE>
- banded_matrix (const matrix_expression<AE> &ae)
The extended copy constructor.
void resize (size_type size1, size_type size2, - size_type lower = 0, size_type upper = 0)Reallocates a banded_matrix to hold (lower - + 1 + upper) diagonals around the main diagonal of - a matrix with size1 rows of size2 - elements. The content of the banded_matrix - is not preserved.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
size_type lower () constReturns the number of diagonals below the main - diagonal.
size_type upper () constReturns the number of diagonals above the main - diagonal.
const_reference operator () (size_type i, - size_type j) constReturns a const reference of the j-th - element in the i-th row.
reference operator () (size_type i, size_type - j)Returns a reference of the j-th element - in the i-th row.
banded_matrix &operator = (const - banded_matrix &m)The assignment operator.
banded_matrix &assign_temporary - (banded_matrix &m)Assigns a temporary. May change the banded matrix m.
template<class AE>
- banded_matrix &operator = (const - matrix_expression<AE> &ae)
The extended assignment operator.
template<class AE>
- banded_matrix &assign (const - matrix_expression<AE> &ae)
Assigns a matrix expression to the banded matrix. - Left and right hand side of the assignment should be - independent.
template<class AE>
- banded_matrix &operator += (const - matrix_expression<AE> &ae)
A computed assignment operator. Adds the matrix - expression to the banded matrix.
template<class AE>
- banded_matrix &plus_assign (const - matrix_expression<AE> &ae)
Adds a matrix expression to the banded matrix. Left - and right hand side of the assignment should be - independent.
template<class AE>
- banded_matrix &operator -= (const - matrix_expression<AE> &ae)
A computed assignment operator. Subtracts the matrix - expression from the banded matrix.
template<class AE>
- banded_matrix &minus_assign (const - matrix_expression<AE> &ae)
Subtracts a matrix expression from the banded matrix. - Left and right hand side of the assignment should be - independent.
template<class AT>
- banded_matrix &operator *= (const AT &at)
A computed assignment operator. Multiplies the banded - matrix with a scalar.
template<class AT>
- banded_matrix &operator /= (const AT &at)
A computed assignment operator. Divides the banded - matrix through a scalar.
void swap (banded_matrix &m)Swaps the contents of the banded matrices.
void insert (size_type i, size_type j, - const_reference t)Inserts the value t at the j-th - element of the i-th row.
void erase (size_type i, size_type j)Erases the value at the j-th elemenst of - the i-th row.
void clear ()Clears the matrix.
const_iterator1 begin1 () constReturns a const_iterator1 pointing to - the beginning of the banded_matrix.
const_iterator1 end1 () constReturns a const_iterator1 pointing to - the end of the banded_matrix.
iterator1 begin1 () Returns a iterator1 pointing to the - beginning of the banded_matrix.
iterator1 end1 () Returns a iterator1 pointing to the end - of the banded_matrix.
const_iterator2 begin2 () constReturns a const_iterator2 pointing to - the beginning of the banded_matrix.
const_iterator2 end2 () constReturns a const_iterator2 pointing to - the end of the banded_matrix.
iterator2 begin2 () Returns a iterator2 pointing to the - beginning of the banded_matrix.
iterator2 end2 () Returns a iterator2 pointing to the end - of the banded_matrix.
const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 - pointing to the beginning of the reversed banded_matrix. -
const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 - pointing to the end of the reversed banded_matrix. -
reverse_iterator1 rbegin1 () Returns a reverse_iterator1 pointing to - the beginning of the reversed banded_matrix. -
reverse_iterator1 rend1 () Returns a reverse_iterator1 pointing to - the end of the reversed banded_matrix.
const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 - pointing to the beginning of the reversed banded_matrix. -
const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 - pointing to the end of the reversed banded_matrix. -
reverse_iterator2 rbegin2 () Returns a reverse_iterator2 pointing to - the beginning of the reversed banded_matrix. -
reverse_iterator2 rend2 () Returns a reverse_iterator2 pointing to - the end of the reversed banded_matrix.
Member Description
banded_matrix () Allocates an uninitialized banded_matrix + that holds zero rows of zero elements.
banded_matrix (size_type size1, size_type size2, +size_type lower = 0, size_type upper = 0)Allocates an uninitialized banded_matrix + that holds (lower + 1 + upper) diagonals around the +main diagonal of a matrix with size1 rows of size2 + elements.
banded_matrix (const banded_matrix &m)The copy constructor.
template<class AE>
+ banded_matrix (const matrix_expression<AE> &ae)
The extended copy constructor.
void resize (size_type size1, size_type size2, + size_type lower = 0, size_type upper = 0)Reallocates a banded_matrix to hold (lower + + 1 + upper) diagonals around the main diagonal of + a matrix with size1 rows of size2 elements. +The content of the banded_matrix is not preserved.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
size_type lower () constReturns the number of diagonals below the main diagonal. +
size_type upper () constReturns the number of diagonals above the main diagonal. +
const_reference operator () (size_type i, size_type +j) constReturns a const reference of the j +-th element in the i-th row.
reference operator () (size_type i, size_type +j)Returns a reference of the j-th element + in the i-th row.
banded_matrix &operator = (const banded_matrix +&m)The assignment operator.
banded_matrix &assign_temporary (banded_matrix +&m)Assigns a temporary. May change the banded matrix m +.
template<class AE>
+ banded_matrix &operator = (const matrix_expression<AE> +&ae)
The extended assignment operator.
template<class AE>
+ banded_matrix &assign (const matrix_expression<AE> +&ae)
Assigns a matrix expression to the banded matrix. Left +and right hand side of the assignment should be independent.
template<class AE>
+ banded_matrix &operator += (const matrix_expression<AE> +&ae)
A computed assignment operator. Adds the matrix expression +to the banded matrix.
template<class AE>
+ banded_matrix &plus_assign (const matrix_expression<AE> +&ae)
Adds a matrix expression to the banded matrix. Left +and right hand side of the assignment should be independent.
template<class AE>
+ banded_matrix &operator -= (const matrix_expression<AE> +&ae)
A computed assignment operator. Subtracts the matrix + expression from the banded matrix.
template<class AE>
+ banded_matrix &minus_assign (const matrix_expression<AE> +&ae)
Subtracts a matrix expression from the banded matrix. + Left and right hand side of the assignment should be independent.
template<class AT>
+ banded_matrix &operator *= (const AT &at)
A computed assignment operator. Multiplies the banded + matrix with a scalar.
template<class AT>
+ banded_matrix &operator /= (const AT &at)
A computed assignment operator. Divides the banded matrix +through a scalar.
void swap (banded_matrix &m)Swaps the contents of the banded matrices.
void insert (size_type i, size_type j, const_reference +t)Inserts the value t at the j-th + element of the i-th row.
void erase (size_type i, size_type j)Erases the value at the j-th elemenst of + the i-th row.
void clear ()Clears the matrix.
const_iterator1 begin1 () constReturns a const_iterator1 pointing to the +beginning of the banded_matrix.
const_iterator1 end1 () constReturns a const_iterator1 pointing to the +end of the banded_matrix.
iterator1 begin1 () Returns a iterator1 pointing to the beginning +of the banded_matrix.
iterator1 end1 () Returns a iterator1 pointing to the end + of the banded_matrix.
const_iterator2 begin2 () constReturns a const_iterator2 pointing to the +beginning of the banded_matrix.
const_iterator2 end2 () constReturns a const_iterator2 pointing to the +end of the banded_matrix.
iterator2 begin2 () Returns a iterator2 pointing to the beginning +of the banded_matrix.
iterator2 end2 () Returns a iterator2 pointing to the end + of the banded_matrix.
const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing +to the beginning of the reversed banded_matrix.
const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing +to the end of the reversed banded_matrix.
reverse_iterator1 rbegin1 () Returns a reverse_iterator1 pointing to + the beginning of the reversed banded_matrix.
reverse_iterator1 rend1 () Returns a reverse_iterator1 pointing to + the end of the reversed banded_matrix.
const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing +to the beginning of the reversed banded_matrix.
const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing +to the end of the reversed banded_matrix.
reverse_iterator2 rbegin2 () Returns a reverse_iterator2 pointing to + the beginning of the reversed banded_matrix.
reverse_iterator2 rend2 () Returns a reverse_iterator2 pointing to + the end of the reversed banded_matrix.
- +

Notes

- -

[1] Supported parameters for the -storage organization are row_major and column_major.

- -

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

- + +

[1] + Supported parameters for the storage organization are row_major + and column_major.

+ +

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

+

Interface

- -
    // Array based banded matrix class
-    template<class T, class F, class A>
-    class banded_matrix:
-        public matrix_expression<banded_matrix<T, F, A> > {
-    public:
-        typedef std::size_t size_type;
-        typedef std::ptrdiff_t difference_type;
-        typedef T value_type;
-        typedef const T &const_reference;
-        typedef T &reference;
-        typedef const T *const_pointer;
-        typedef T *pointer;
-        typedef F functor_type;
-        typedef A array_type;
-        typedef const A const_array_type;
-        typedef const banded_matrix<T, F, A> const_self_type;
-        typedef banded_matrix<T, F, A> self_type;
-        typedef const matrix_const_reference<const_self_type> const_closure_type;
-        typedef matrix_reference<self_type> closure_type;
-        typedef packed_tag storage_category;
-        typedef typename F::orientation_category orientation_category;
-
-        // Construction and destruction
-        banded_matrix ();
-        banded_matrix (size_type size1, size_type size2, size_type lower = 0, size_type upper = 0);
-        banded_matrix (const banded_matrix &m);
-        template<class AE>
-        banded_matrix (const matrix_expression<AE> &ae, size_type lower = 0, size_type upper = 0);
-
-        // Accessors
-        size_type size1 () const;
-        size_type size2 () const;
-        size_type lower () const;
-        size_type upper () const;
-        const_array_type &data () const;
-        array_type &data ();
-
-        // Resizing
-        void resize (size_type size1, size_type size2, size_type lower = 0, size_type upper = 0);
-
-        // Element access
-        const_reference operator () (size_type i, size_type j) const;
-        reference operator () (size_type i, size_type j);
-
-        // Assignment
-        banded_matrix &operator = (const banded_matrix &m);
-        banded_matrix &assign_temporary (banded_matrix &m);
-        template<class AE>
-        banded_matrix &operator = (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_matrix &reset (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_matrix &assign (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_matrix& operator += (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_matrix &plus_assign (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_matrix& operator -= (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_matrix &minus_assign (const matrix_expression<AE> &ae);
-        template<class AT>
-        banded_matrix& operator *= (const AT &at);
-        template<class AT>
-        banded_matrix& operator /= (const AT &at);
-
-        // Swapping
-        void swap (banded_matrix &m);
-        friend void swap (banded_matrix &m1, banded_matrix &m2);
-
-        // Element insertion and erasure
-        void insert (size_type i, size_type j, const_reference t);
-        void erase (size_type i, size_type j);
-        void clear ();
-
-        class const_iterator1;
-        class iterator1;
-        class const_iterator2;
-        class iterator2;
-        typedef reverse_iterator_base1<const_iterator1> const_reverse_iterator1;
-        typedef reverse_iterator_base1<iterator1> reverse_iterator1;
-        typedef reverse_iterator_base2<const_iterator2> const_reverse_iterator2;
-        typedef reverse_iterator_base2<iterator2> reverse_iterator2;
-
-        // Element lookup
-        const_iterator1 find1 (int rank, size_type i, size_type j) const;
-        iterator1 find1 (int rank, size_type i, size_type j);
-        const_iterator2 find2 (int rank, size_type i, size_type j) const;
-        iterator2 find2 (int rank, size_type i, size_type j);
-        const_iterator1 find_first1 (int rank, size_type i, size_type j) const;
-        iterator1 find_first1 (int rank, size_type i, size_type j);
-        const_iterator1 find_last1 (int rank, size_type i, size_type j) const;
-        iterator1 find_last1 (int rank, size_type i, size_type j);
-        const_iterator2 find_first2 (int rank, size_type i, size_type j) const;
-        iterator2 find_first2 (int rank, size_type i, size_type j);
-        const_iterator2 find_last2 (int rank, size_type i, size_type j) const;
-        iterator2 find_last2 (int rank, size_type i, size_type j);
-
-        // Iterators simply are indices.
-
-        class const_iterator1:
-            public container_const_reference<banded_matrix>,
-            public random_access_iterator_base<const_iterator1, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename banded_matrix::difference_type difference_type;
-            typedef typename banded_matrix::value_type value_type;
-            typedef typename banded_matrix::const_reference reference;
-            typedef typename banded_matrix::const_pointer pointer;
-            typedef const_iterator2 dual_iterator_type;
-            typedef const_reverse_iterator2 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            const_iterator1 ();
-            const_iterator1 (const banded_matrix &m, size_type it1, size_type it2);
-            const_iterator1 (const iterator1 &it);
-
-            // Arithmetic
-            const_iterator1 &operator ++ ();
-            const_iterator1 &operator -- ();
-            const_iterator1 &operator += (difference_type n);
-            const_iterator1 &operator -= (difference_type n);
-            difference_type operator - (const const_iterator1 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            const_iterator2 begin () const;
-            const_iterator2 end () const;
-            const_reverse_iterator2 rbegin () const;
-            const_reverse_iterator2 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            const_iterator1 &operator = (const const_iterator1 &it);
-
-            // Comparison
-            bool operator == (const const_iterator1 &it) const;
-            bool operator < (const const_iterator1 &it) const;
-        };
-
-        const_iterator1 begin1 () const;
-        const_iterator1 end1 () const;
-
-        class iterator1:
-            public container_reference<banded_matrix>,
-            public random_access_iterator_base<iterator1, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename banded_matrix::difference_type difference_type;
-            typedef typename banded_matrix::value_type value_type;
-            typedef typename banded_matrix::reference reference;
-            typedef typename banded_matrix::pointer pointer;
-            typedef iterator2 dual_iterator_type;
-            typedef reverse_iterator2 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            iterator1 ();
-            iterator1 (banded_matrix &m, size_type it1, size_type it2);
-
-            // Arithmetic
-            iterator1 &operator ++ ();
-            iterator1 &operator -- ();
-            iterator1 &operator += (difference_type n);
-            iterator1 &operator -= (difference_type n);
-            difference_type operator - (const iterator1 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            iterator2 begin () const;
-            iterator2 end () const;
-            reverse_iterator2 rbegin () const;
-            reverse_iterator2 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            iterator1 &operator = (const iterator1 &it);
-
-            // Comparison
-            bool operator == (const iterator1 &it) const;
-            bool operator < (const iterator1 &it) const;
-        };
-
-        iterator1 begin1 ();
-        iterator1 end1 ();
-
-        class const_iterator2:
-            public container_const_reference<banded_matrix>,
-            public random_access_iterator_base<const_iterator2, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename banded_matrix::difference_type difference_type;
-            typedef typename banded_matrix::value_type value_type;
-            typedef typename banded_matrix::const_reference reference;
-            typedef typename banded_matrix::const_pointer pointer;
-            typedef const_iterator1 dual_iterator_type;
-            typedef const_reverse_iterator1 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            const_iterator2 ();
-            const_iterator2 (const banded_matrix &m, size_type it1, size_type it2);
-            const_iterator2 (const iterator2 &it);
-
-            // Arithmetic
-            const_iterator2 &operator ++ ();
-            const_iterator2 &operator -- ();
-            const_iterator2 &operator += (difference_type n);
-            const_iterator2 &operator -= (difference_type n);
-            difference_type operator - (const const_iterator2 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            const_iterator1 begin () const;
-            const_iterator1 end () const;
-            const_reverse_iterator1 rbegin () const;
-            const_reverse_iterator1 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            const_iterator2 &operator = (const const_iterator2 &it);
-
-            // Comparison
-            bool operator == (const const_iterator2 &it) const;
-            bool operator < (const const_iterator2 &it) const;
-        };
-
-        const_iterator2 begin2 () const;
-        const_iterator2 end2 () const;
-
-        class iterator2:
-            public container_reference<banded_matrix>,
-            public random_access_iterator_base<iterator2, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename banded_matrix::difference_type difference_type;
-            typedef typename banded_matrix::value_type value_type;
-            typedef typename banded_matrix::reference reference;
-            typedef typename banded_matrix::pointer pointer;
-            typedef iterator1 dual_iterator_type;
-            typedef reverse_iterator1 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            iterator2 ();
-            iterator2 (banded_matrix &m, size_type it1, size_type it2);
-
-            // Arithmetic
-            iterator2 &operator ++ ();
-            iterator2 &operator -- ();
-            iterator2 &operator += (difference_type n);
-            iterator2 &operator -= (difference_type n);
-            difference_type operator - (const iterator2 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            iterator1 begin () const;
-            iterator1 end () const;
-            reverse_iterator1 rbegin () const;
-            reverse_iterator1 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            iterator2 &operator = (const iterator2 &it);
-
-            // Comparison
-            bool operator == (const iterator2 &it) const;
-            bool operator < (const iterator2 &it) const;
-        };
-
-        iterator2 begin2 ();
-        iterator2 end2 ();
-
-        // Reverse iterators
-
-        const_reverse_iterator1 rbegin1 () const;
-        const_reverse_iterator1 rend1 () const;
-
-        reverse_iterator1 rbegin1 ();
-        reverse_iterator1 rend1 ();
-
-        const_reverse_iterator2 rbegin2 () const;
-        const_reverse_iterator2 rend2 () const;
-
-        reverse_iterator2 rbegin2 ();
-        reverse_iterator2 rend2 ();
-    };
- -

Banded Adaptor

- + +
    // Array based banded matrix class
template<class T, class F, class A>
class banded_matrix:
public matrix_expression<banded_matrix<T, F, A> > {
public:
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T value_type;
typedef const T &const_reference;
typedef T &reference;
typedef const T *const_pointer;
typedef T *pointer;
typedef F functor_type;
typedef A array_type;
typedef const A const_array_type;
typedef const banded_matrix<T, F, A> const_self_type;
typedef banded_matrix<T, F, A> self_type;
typedef const matrix_const_reference<const_self_type> const_closure_type;
typedef matrix_reference<self_type> closure_type;
typedef packed_tag storage_category;
typedef typename F::orientation_category orientation_category;

// Construction and destruction
banded_matrix ();
banded_matrix (size_type size1, size_type size2, size_type lower = 0, size_type upper = 0);
banded_matrix (const banded_matrix &m);
template<class AE>
banded_matrix (const matrix_expression<AE> &ae, size_type lower = 0, size_type upper = 0);

// Accessors
size_type size1 () const;
size_type size2 () const;
size_type lower () const;
size_type upper () const;
const_array_type &data () const;
array_type &data ();

// Resizing
void resize (size_type size1, size_type size2, size_type lower = 0, size_type upper = 0);

// Element access
const_reference operator () (size_type i, size_type j) const;
reference operator () (size_type i, size_type j);

// Assignment
banded_matrix &operator = (const banded_matrix &m);
banded_matrix &assign_temporary (banded_matrix &m);
template<class AE>
banded_matrix &operator = (const matrix_expression<AE> &ae);
template<class AE>
banded_matrix &reset (const matrix_expression<AE> &ae);
template<class AE>
banded_matrix &assign (const matrix_expression<AE> &ae);
template<class AE>
banded_matrix& operator += (const matrix_expression<AE> &ae);
template<class AE>
banded_matrix &plus_assign (const matrix_expression<AE> &ae);
template<class AE>
banded_matrix& operator -= (const matrix_expression<AE> &ae);
template<class AE>
banded_matrix &minus_assign (const matrix_expression<AE> &ae);
template<class AT>
banded_matrix& operator *= (const AT &at);
template<class AT>
banded_matrix& operator /= (const AT &at);

// Swapping
void swap (banded_matrix &m);
friend void swap (banded_matrix &m1, banded_matrix &m2);

// Element insertion and erasure
void insert (size_type i, size_type j, const_reference t);
void erase (size_type i, size_type j);
void clear ();

class const_iterator1;
class iterator1;
class const_iterator2;
class iterator2;
typedef reverse_iterator_base1<const_iterator1> const_reverse_iterator1;
typedef reverse_iterator_base1<iterator1> reverse_iterator1;
typedef reverse_iterator_base2<const_iterator2> const_reverse_iterator2;
typedef reverse_iterator_base2<iterator2> reverse_iterator2;

// Element lookup
const_iterator1 find1 (int rank, size_type i, size_type j) const;
iterator1 find1 (int rank, size_type i, size_type j);
const_iterator2 find2 (int rank, size_type i, size_type j) const;
iterator2 find2 (int rank, size_type i, size_type j);
const_iterator1 find_first1 (int rank, size_type i, size_type j) const;
iterator1 find_first1 (int rank, size_type i, size_type j);
const_iterator1 find_last1 (int rank, size_type i, size_type j) const;
iterator1 find_last1 (int rank, size_type i, size_type j);
const_iterator2 find_first2 (int rank, size_type i, size_type j) const;
iterator2 find_first2 (int rank, size_type i, size_type j);
const_iterator2 find_last2 (int rank, size_type i, size_type j) const;
iterator2 find_last2 (int rank, size_type i, size_type j);

// Iterators simply are indices.

class const_iterator1:
public container_const_reference<banded_matrix>,
public random_access_iterator_base<const_iterator1, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename banded_matrix::difference_type difference_type;
typedef typename banded_matrix::value_type value_type;
typedef typename banded_matrix::const_reference reference;
typedef typename banded_matrix::const_pointer pointer;
typedef const_iterator2 dual_iterator_type;
typedef const_reverse_iterator2 dual_reverse_iterator_type;

// Construction and destruction
const_iterator1 ();
const_iterator1 (const banded_matrix &m, size_type it1, size_type it2);
const_iterator1 (const iterator1 &it);

// Arithmetic
const_iterator1 &operator ++ ();
const_iterator1 &operator -- ();
const_iterator1 &operator += (difference_type n);
const_iterator1 &operator -= (difference_type n);
difference_type operator - (const const_iterator1 &it) const;

// Dereference
reference operator * () const;

const_iterator2 begin () const;
const_iterator2 end () const;
const_reverse_iterator2 rbegin () const;
const_reverse_iterator2 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
const_iterator1 &operator = (const const_iterator1 &it);

// Comparison
bool operator == (const const_iterator1 &it) const;
bool operator < (const const_iterator1 &it) const;
};

const_iterator1 begin1 () const;
const_iterator1 end1 () const;

class iterator1:
public container_reference<banded_matrix>,
public random_access_iterator_base<iterator1, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename banded_matrix::difference_type difference_type;
typedef typename banded_matrix::value_type value_type;
typedef typename banded_matrix::reference reference;
typedef typename banded_matrix::pointer pointer;
typedef iterator2 dual_iterator_type;
typedef reverse_iterator2 dual_reverse_iterator_type;

// Construction and destruction
iterator1 ();
iterator1 (banded_matrix &m, size_type it1, size_type it2);

// Arithmetic
iterator1 &operator ++ ();
iterator1 &operator -- ();
iterator1 &operator += (difference_type n);
iterator1 &operator -= (difference_type n);
difference_type operator - (const iterator1 &it) const;

// Dereference
reference operator * () const;

iterator2 begin () const;
iterator2 end () const;
reverse_iterator2 rbegin () const;
reverse_iterator2 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
iterator1 &operator = (const iterator1 &it);

// Comparison
bool operator == (const iterator1 &it) const;
bool operator < (const iterator1 &it) const;
};

iterator1 begin1 ();
iterator1 end1 ();

class const_iterator2:
public container_const_reference<banded_matrix>,
public random_access_iterator_base<const_iterator2, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename banded_matrix::difference_type difference_type;
typedef typename banded_matrix::value_type value_type;
typedef typename banded_matrix::const_reference reference;
typedef typename banded_matrix::const_pointer pointer;
typedef const_iterator1 dual_iterator_type;
typedef const_reverse_iterator1 dual_reverse_iterator_type;

// Construction and destruction
const_iterator2 ();
const_iterator2 (const banded_matrix &m, size_type it1, size_type it2);
const_iterator2 (const iterator2 &it);

// Arithmetic
const_iterator2 &operator ++ ();
const_iterator2 &operator -- ();
const_iterator2 &operator += (difference_type n);
const_iterator2 &operator -= (difference_type n);
difference_type operator - (const const_iterator2 &it) const;

// Dereference
reference operator * () const;

const_iterator1 begin () const;
const_iterator1 end () const;
const_reverse_iterator1 rbegin () const;
const_reverse_iterator1 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
const_iterator2 &operator = (const const_iterator2 &it);

// Comparison
bool operator == (const const_iterator2 &it) const;
bool operator < (const const_iterator2 &it) const;
};

const_iterator2 begin2 () const;
const_iterator2 end2 () const;

class iterator2:
public container_reference<banded_matrix>,
public random_access_iterator_base<iterator2, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename banded_matrix::difference_type difference_type;
typedef typename banded_matrix::value_type value_type;
typedef typename banded_matrix::reference reference;
typedef typename banded_matrix::pointer pointer;
typedef iterator1 dual_iterator_type;
typedef reverse_iterator1 dual_reverse_iterator_type;

// Construction and destruction
iterator2 ();
iterator2 (banded_matrix &m, size_type it1, size_type it2);

// Arithmetic
iterator2 &operator ++ ();
iterator2 &operator -- ();
iterator2 &operator += (difference_type n);
iterator2 &operator -= (difference_type n);
difference_type operator - (const iterator2 &it) const;

// Dereference
reference operator * () const;

iterat +or1 begin () const;
iterator1 end () const;
reverse_iterator1 rbegin () const;
reverse_iterator1 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
iterator2 &operator = (const iterator2 &it);

// Comparison
bool operator == (const iterator2 &it) const;
bool operator < (const iterator2 &it) const;
};

iterator2 begin2 ();
iterator2 end2 ();

// Reverse iterators

const_reverse_iterator1 rbegin1 () const;
const_reverse_iterator1 rend1 () const;

reverse_iterator1 rbegin1 ();
reverse_iterator1 rend1 ();

const_reverse_iterator2 rbegin2 () const;
const_reverse_iterator2 rend2 () const;

reverse_iterator2 rbegin2 ();
reverse_iterator2 rend2 ();
};
+ +

+Banded Adaptor

+

Description

- -

The templated class banded_adaptor<M> is a -banded matrix adaptor for other matrices.

- + +

The templated class banded_adaptor<M> is a banded matrix +adaptor for other matrices.

+

Example

- -
int main () {
-    using namespace boost::numeric::ublas;
-    matrix<double> m (3, 3);
-    banded_adaptor<matrix<double> > ba (m, 1, 1);
-    for (int i = 0; i < ba.size1 (); ++ i)
-        for (int j = std::max (i - 1, 0); j < std::min (i + 2, ba.size2 ()); ++ j)
-            ba (i, j) = 3 * i + j;
-    std::cout << ba << std::endl;
-}
- + +
#include <boost/numeric/ublas/banded.hpp>
#include <boost/numeric/ublas/io.hpp>

int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
banded_adaptor<matrix<double> > ba (m, 1, 1);
for (signed i = 0; i < signed (ba.size1 ()); ++ i)
for (signed j = std::max (i - 1, 0); j < std::min (i + 2, signed (ba.size2 ())); ++ j)
ba (i, j) = 3 * i + j;
std::cout << ba << std::endl;
}

Definition

- +

Defined in the header banded.hpp.

- +

Template parameters

- + + - - - - - - - - - + + + + + + + + + + +
Parameter Description Default
MThe type of the adapted matrix. 
Parameter Description Default
MThe type of the adapted matrix. 
- +

Model of

- -

Matrix Expression. -

- + +

Matrix Expression +.

+

Type requirements

- -

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

- + +

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

+

Public base classes

- -

matrix_expression<banded_adaptor<M> > -

- + +

matrix_expression<banded_adaptor<M> >

+

Members

- + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Member Description
banded_adaptor () Constructs a banded_adaptor that holds - zero rows of zero elements.
banded_adaptor (matrix_type &data, - size_type lower = 0, size_type upper = 0)Constructs a banded_adaptor that holds (lower - + 1 + upper) diagonals around the main diagonal of - a matrix.
banded_adaptor (const banded_adaptor &m)The copy constructor.
template<class AE>
- banded_adaptor (const matrix_expression<AE> - &ae)
The extended copy constructor.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
size_type lower () constReturns the number of diagonals below the main - diagonal.
size_type upper () constReturns the number of diagonals above the main - diagonal.
const_reference operator () (size_type i, - size_type j) constReturns a const reference of the j-th - element in the i-th row.
reference operator () (size_type i, size_type - j)Returns a reference of the j-th element - in the i-th row.
banded_adaptor &operator = (const - banded_adaptor &m)The assignment operator.
banded_adaptor &assign_temporary - (banded_adaptor &m)Assigns a temporary. May change the banded adaptor m.
template<class AE>
- banded_adaptor &operator = (const - matrix_expression<AE> &ae)
The extended assignment operator.
template<class AE>
- banded_adaptor &assign (const - matrix_expression<AE> &ae)
Assigns a matrix expression to the banded adaptor. - Left and right hand side of the assignment should be - independent.
template<class AE>
- banded_adaptor &operator += (const - matrix_expression<AE> &ae)
A computed assignment operator. Adds the matrix - expression to the banded adaptor.
template<class AE>
- banded_adaptor &plus_assign (const - matrix_expression<AE> &ae)
Adds a matrix expression to the banded adaptor. Left - and right hand side of the assignment should be - independent.
template<class AE>
- banded_adaptor &operator -= (const - matrix_expression<AE> &ae)
A computed assignment operator. Subtracts the matrix - expression from the banded adaptor.
template<class AE>
- banded_adaptor &minus_assign (const - matrix_expression<AE> &ae)
Subtracts a matrix expression from the banded - adaptor. Left and right hand side of the assignment - should be independent.
template<class AT>
- banded_adaptor &operator *= (const AT &at)
A computed assignment operator. Multiplies the banded - adaptor with a scalar.
template<class AT>
- banded_adaptor &operator /= (const AT &at)
A computed assignment operator. Divides the banded - adaptor through a scalar.
void swap (banded_adaptor &m)Swaps the contents of the banded adaptors.
const_iterator1 begin1 () constReturns a const_iterator1 pointing to - the beginning of the banded_adaptor.
const_iterator1 end1 () constReturns a const_iterator1 pointing to - the end of the banded_adaptor.
iterator1 begin1 () Returns a iterator1 pointing to the - beginning of the banded_adaptor.
iterator1 end1 () Returns a iterator1 pointing to the end - of the banded_adaptor.
const_iterator2 begin2 () constReturns a const_iterator2 pointing to - the beginning of the banded_adaptor.
const_iterator2 end2 () constReturns a const_iterator2 pointing to - the end of the banded_adaptor.
iterator2 begin2 () Returns a iterator2 pointing to the - beginning of the banded_adaptor.
iterator2 end2 () Returns a iterator2 pointing to the end - of the banded_adaptor.
const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 - pointing to the beginning of the reversed banded_adaptor. -
const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 - pointing to the end of the reversed banded_adaptor. -
reverse_iterator1 rbegin1 () Returns a reverse_iterator1 pointing to - the beginning of the reversed banded_adaptor. -
reverse_iterator1 rend1 () Returns a reverse_iterator1 pointing to - the end of the reversed banded_adaptor.
const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 - pointing to the beginning of the reversed banded_adaptor. -
const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 - pointing to the end of the reversed banded_adaptor. -
reverse_iterator2 rbegin2 () Returns a reverse_iterator2 pointing to - the beginning of the reversed banded_adaptor. -
reverse_iterator2 rend2 () Returns a reverse_iterator2 pointing to - the end of the reversed banded_adaptor.
Member Description
banded_adaptor () Constructs a banded_adaptor that holds +zero rows of zero elements.
banded_adaptor (matrix_type &data, size_type +lower = 0, size_type upper = 0)Constructs a banded_adaptor that holds (lower + + 1 + upper) diagonals around the main diagonal of + a matrix.
banded_adaptor (const banded_adaptor &m)The copy constructor.
template<class AE>
+ banded_adaptor (const matrix_expression<AE> &ae)
The extended copy constructor.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
size_type lower () constReturns the number of diagonals below the main diagonal. +
size_type upper () constReturns the number of diagonals above the main diagonal. +
const_reference operator () (size_type i, size_type +j) constReturns a const reference of the j +-th element in the i-th row.
reference operator () (size_type i, size_type +j)Returns a reference of the j-th element + in the i-th row.
banded_adaptor &operator = (const banded_adaptor +&m)The assignment operator.
banded_adaptor &assign_temporary (banded_adaptor +&m)Assigns a temporary. May change the banded adaptor m +.
template<class AE>
+ banded_adaptor &operator = (const matrix_expression<AE> +&ae)
The extended assignment operator.
template<class AE>
+ banded_adaptor &assign (const matrix_expression<AE> +&ae)
Assigns a matrix expression to the banded adaptor. Left +and right hand side of the assignment should be independent.
template<class AE>
+ banded_adaptor &operator += (const matrix_expression<AE> +&ae)
A computed assignment operator. Adds the matrix expression +to the banded adaptor.
template<class AE>
+ banded_adaptor &plus_assign (const matrix_expression<AE> +&ae)
Adds a matrix expression to the banded adaptor. Left + and right hand side of the assignment should be independent.
template<class AE>
+ banded_adaptor &operator -= (const matrix_expression<AE> +&ae)
A computed assignment operator. Subtracts the matrix + expression from the banded adaptor.
template<class AE>
+ banded_adaptor &minus_assign (const matrix_expression<AE> +&ae)
Subtracts a matrix expression from the banded adaptor. +Left and right hand side of the assignment should be independent.
template<class AT>
+ banded_adaptor &operator *= (const AT &at)
A computed assignment operator. Multiplies the banded + adaptor with a scalar.
template<class AT>
+ banded_adaptor &operator /= (const AT &at)
A computed assignment operator. Divides the banded adaptor +through a scalar.
void swap (banded_adaptor &m)Swaps the contents of the banded adaptors.
const_iterator1 begin1 () constReturns a const_iterator1 pointing to the +beginning of the banded_adaptor.
const_iterator1 end1 () constReturns a const_iterator1 pointing to the +end of the banded_adaptor.
iterator1 begin1 () Returns a iterator1 pointing to the beginning +of the banded_adaptor.
iterator1 end1 () Returns a iterator1 pointing to the end + of the banded_adaptor.
const_iterator2 begin2 () constReturns a const_iterator2 pointing to the +beginning of the banded_adaptor.
const_iterator2 end2 () constReturns a const_iterator2 pointing to the +end of the banded_adaptor.
iterator2 begin2 () Returns a iterator2 pointing to the beginning +of the banded_adaptor.
iterator2 end2 () Returns a iterator2 pointing to the end + of the banded_adaptor.
const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing +to the beginning of the reversed banded_adaptor.
const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing +to the end of the reversed banded_adaptor.
reverse_iterator1 rbegin1 () Returns a reverse_iterator1 pointing to + the beginning of the reversed banded_adaptor.
reverse_iterator1 rend1 () Returns a reverse_iterator1 pointing to + the end of the reversed banded_adaptor.
const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing +to the beginning of the reversed banded_adaptor.
const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing +to the end of the reversed banded_adaptor.
reverse_iterator2 rbegin2 () Returns a reverse_iterator2 pointing to + the beginning of the reversed banded_adaptor.
reverse_iterator2 rend2 () Returns a reverse_iterator2 pointing to + the end of the reversed banded_adaptor.
- +

Interface

- -
    // Banded matrix adaptor class
-    template<class M>
-    class banded_adaptor:
-        public matrix_expression<banded_adaptor<M> > {
-    public:
-        typedef const M const_matrix_type;
-        typedef M matrix_type;
-        typedef typename M::size_type size_type;
-        typedef typename M::difference_type difference_type;
-        typedef typename M::value_type value_type;
-        typedef typename M::const_reference const_reference;
-        typedef typename M::reference reference;
-        typedef typename M::const_pointer const_pointer;
-        typedef typename M::pointer pointer;
-        typedef const banded_adaptor<M> const_self_type;
-        typedef banded_adaptor<M> self_type;
-        typedef const matrix_const_reference<const_self_type> const_closure_type;
-        typedef matrix_reference<self_type> closure_type;
-        typedef typename storage_restrict_traits<typename M::storage_category,
-                                                 packed_proxy_tag>::storage_category storage_category;
-        typedef typename M::orientation_category orientation_category;
-
-        // Construction and destruction
-        banded_adaptor ();
-        banded_adaptor (matrix_type &data, size_type lower = 0, size_type upper = 0);
-        banded_adaptor (const banded_adaptor &m);
-
-        // Accessors
-        size_type size1 () const;
-        size_type size2 () const;
-        size_type lower () const;
-        size_type upper () const;
-        const_matrix_type &data () const;
-        matrix_type &data ();
-
-        // Element access
-        const_reference operator () (size_type i, size_type j) const;
-        reference operator () (size_type i, size_type j);
-
-        // Assignment
-        banded_adaptor &operator = (const banded_adaptor &m);
-        banded_adaptor &assign_temporary (banded_adaptor &m);
-        template<class AE>
-        banded_adaptor &operator = (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_adaptor &assign (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_adaptor& operator += (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_adaptor &plus_assign (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_adaptor& operator -= (const matrix_expression<AE> &ae);
-        template<class AE>
-        banded_adaptor &minus_assign (const matrix_expression<AE> &ae);
-        template<class AT>
-        banded_adaptor& operator *= (const AT &at);
-        template<class AT>
-        banded_adaptor& operator /= (const AT &at);
-
-        // Swapping
-        void swap (banded_adaptor &m);
-        friend void swap (banded_adaptor &m1, banded_adaptor &m2);
-
-        class const_iterator1;
-        class iterator1;
-        class const_iterator2;
-        class iterator2;
-        typedef reverse_iterator_base1<const_iterator1> const_reverse_iterator1;
-        typedef reverse_iterator_base1<iterator1> reverse_iterator1;
-        typedef reverse_iterator_base2<const_iterator2> const_reverse_iterator2;
-        typedef reverse_iterator_base2<iterator2> reverse_iterator2;
-
-        // Element lookup
-        const_iterator1 find1 (int rank, size_type i, size_type j) const;
-        iterator1 find1 (int rank, size_type i, size_type j);
-        const_iterator2 find2 (int rank, size_type i, size_type j) const;
-        iterator2 find2 (int rank, size_type i, size_type j);
-        const_iterator1 find_first1 (int rank, size_type i, size_type j) const;
-        iterator1 find_first1 (int rank, size_type i, size_type j);
-        const_iterator1 find_last1 (int rank, size_type i, size_type j) const;
-        iterator1 find_last1 (int rank, size_type i, size_type j);
-        const_iterator2 find_first2 (int rank, size_type i, size_type j) const;
-        iterator2 find_first2 (int rank, size_type i, size_type j);
-        const_iterator2 find_last2 (int rank, size_type i, size_type j) const;
-        iterator2 find_last2 (int rank, size_type i, size_type j);
-
-        // Iterators simply are indices.
-
-        class const_iterator1:
-            public container_const_reference<banded_adaptor>,
-            public random_access_iterator_base<const_iterator1, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename banded_adaptor::difference_type difference_type;
-            typedef typename banded_adaptor::value_type value_type;
-            typedef typename banded_adaptor::const_reference reference;
-            typedef typename banded_adaptor::const_pointer pointer;
-            typedef const_iterator2 dual_iterator_type;
-            typedef const_reverse_iterator2 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            const_iterator1 ();
-            const_iterator1 (const banded_adaptor &m, size_type it1, size_type it2);
-            const_iterator1 (const iterator1 &it);
-
-            // Arithmetic
-            const_iterator1 &operator ++ ();
-            const_iterator1 &operator -- ();
-            const_iterator1 &operator += (difference_type n);
-            const_iterator1 &operator -= (difference_type n);
-            difference_type operator - (const const_iterator1 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            const_iterator2 begin () const;
-            const_iterator2 end () const;
-            const_reverse_iterator2 rbegin () const;
-            const_reverse_iterator2 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            const_iterator1 &operator = (const const_iterator1 &it);
-
-            // Comparison
-            bool operator == (const const_iterator1 &it) const;
-            bool operator < (const const_iterator1 &it) const;
-        };
-
-        const_iterator1 begin1 () const;
-        const_iterator1 end1 () const;
-
-        class iterator1:
-            public container_reference<banded_adaptor>,
-            public random_access_iterator_base<iterator1, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename banded_adaptor::difference_type difference_type;
-            typedef typename banded_adaptor::value_type value_type;
-            typedef typename banded_adaptor::reference reference;
-            typedef typename banded_adaptor::pointer pointer;
-            typedef iterator2 dual_iterator_type;
-            typedef reverse_iterator2 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            iterator1 ();
-            iterator1 (banded_adaptor &m, size_type it1, size_type it2);
-
-            // Arithmetic
-            iterator1 &operator ++ ();
-            iterator1 &operator -- ();
-            iterator1 &operator += (difference_type n);
-            iterator1 &operator -= (difference_type n);
-            difference_type operator - (const iterator1 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            iterator2 begin () const;
-            iterator2 end () const;
-            reverse_iterator2 rbegin () const;
-            reverse_iterator2 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            iterator1 &operator = (const iterator1 &it);
-
-            // Comparison
-            bool operator == (const iterator1 &it) const;
-            bool operator < (const iterator1 &it) const;
-        };
-
-        iterator1 begin1 ();
-        iterator1 end1 ();
-
-        class const_iterator2:
-            public container_const_reference<banded_adaptor>,
-            public random_access_iterator_base<const_iterator2, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename banded_adaptor::difference_type difference_type;
-            typedef typename banded_adaptor::value_type value_type;
-            typedef typename banded_adaptor::const_reference reference;
-            typedef typename banded_adaptor::const_pointer pointer;
-            typedef const_iterator1 dual_iterator_type;
-            typedef const_reverse_iterator1 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            const_iterator2 ();
-            const_iterator2 (const banded_adaptor &m, size_type it1, size_type it2);
-            const_iterator2 (const iterator2 &it);
-
-            // Arithmetic
-            const_iterator2 &operator ++ ();
-            const_iterator2 &operator -- ();
-            const_iterator2 &operator += (difference_type n);
-            const_iterator2 &operator -= (difference_type n);
-            difference_type operator - (const const_iterator2 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            const_iterator1 begin () const;
-            const_iterator1 end () const;
-            const_reverse_iterator1 rbegin () const;
-            const_reverse_iterator1 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            const_iterator2 &operator = (const const_iterator2 &it);
-
-            // Comparison
-            bool operator == (const const_iterator2 &it) const;
-            bool operator < (const const_iterator2 &it) const;
-        };
-
-        const_iterator2 begin2 () const;
-        const_iterator2 end2 () const;
-
-        class iterator2:
-            public container_reference<banded_adaptor>,
-            public random_access_iterator_base<iterator2, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename banded_adaptor::difference_type difference_type;
-            typedef typename banded_adaptor::value_type value_type;
-            typedef typename banded_adaptor::reference reference;
-            typedef typename banded_adaptor::pointer pointer;
-            typedef iterator1 dual_iterator_type;
-            typedef reverse_iterator1 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            iterator2 ();
-            iterator2 (banded_adaptor &m, size_type it1, size_type it2);
-
-            // Arithmetic
-            iterator2 &operator ++ ();
-            iterator2 &operator -- ();
-            iterator2 &operator += (difference_type n);
-            iterator2 &operator -= (difference_type n);
-            difference_type operator - (const iterator2 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            iterator1 begin () const;
-            iterator1 end () const;
-            reverse_iterator1 rbegin () const;
-            reverse_iterator1 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            iterator2 &operator = (const iterator2 &it);
-
-            // Comparison
-            bool operator == (const iterator2 &it) const;
-            bool operator < (const iterator2 &it) const;
-        };
-
-        iterator2 begin2 ();
-        iterator2 end2 ();
-
-        // Reverse iterators
-
-        const_reverse_iterator1 rbegin1 () const;
-        const_reverse_iterator1 rend1 () const;
-
-        reverse_iterator1 rbegin1 ();
-        reverse_iterator1 rend1 ();
-
-        const_reverse_iterator2 rbegin2 () const;
-        const_reverse_iterator2 rend2 () const;
-
-        reverse_iterator2 rbegin2 ();
-        reverse_iterator2 rend2 ();
-    };
- -
- -

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.

- + +
    // Banded matrix adaptor class
template<class M>
class banded_adaptor:
public matrix_expression<banded_adaptor<M> > {
public:
typedef const M const_matrix_type;
typedef M matrix_type;
typedef typename M::size_type size_type;
typedef typename M::difference_type difference_type;
typedef typename M::value_type value_type;
typedef typename M::const_reference const_reference;
typedef typename M::reference reference;
typedef typename M::const_pointer const_pointer;
typedef typename M::pointer pointer;
typedef const banded_adaptor<M> const_self_type;
typedef banded_adaptor<M> self_type;
typedef const matrix_const_reference<const_self_type> const_closure_type;
typedef matrix_reference<self_type> closure_type;
typedef typename storage_restrict_traits<typename M::storage_category,
packed_proxy_tag>::storage_category storage_category;
typedef typename M::orientation_category orientation_category;

// Construction and destruction
banded_adaptor ();
banded_adaptor (matrix_type &data, size_type lower = 0, size_type upper = 0);
banded_adaptor (const banded_adaptor &m);

// Accessors
size_type size1 () const;
size_type size2 () const;
size_type lower () const;
size_type upper () const;
const_matrix_type &data () const;
matrix_type &data ();

// Element access
const_reference operator () (size_type i, size_type j) const;
reference operator () (size_type i, size_type j);

// Assignment
banded_adaptor &operator = (const banded_adaptor &m);
banded_adaptor &assign_temporary (banded_adaptor &m);
template<class AE>
banded_adaptor &operator = (const matrix_expression<AE> &ae);
template<class AE>
banded_adaptor &assign (const matrix_expression<AE> &ae);
template<class AE>
banded_adaptor& operator += (const matrix_expression<AE> &ae);
template<class AE>
banded_adaptor &plus_assign (const matrix_expression<AE> &ae);
template<class AE>
banded_adaptor& operator -= (const matrix_expression<AE> &ae);
template<class AE>
banded_adaptor &minus_assign (const matrix_expression<AE> &ae);
template<class AT>
banded_adaptor& operator *= (const AT &at);
template<class AT>
banded_adaptor& operator /= (const AT &at);

// Swapping
void swap (banded_adaptor &m);
friend void swap (banded_adaptor &m1, banded_adaptor &m2);

class const_iterator1;
class iterator1;
class const_iterator2;
class iterator2;
typedef reverse_iterator_base1<const_iterator1> const_reverse_iterator1;
typedef reverse_iterator_base1<iterator1> reverse_iterator1;
typedef reverse_iterator_base2<const_iterator2> const_reverse_iterator2;
typedef reverse_iterator_base2<iterator2> reverse_iterator2;

// Element lookup
const_iterator1 find1 (int rank, size_type i, size_type j) const;
iterator1 find1 (int rank, size_type i, size_type j);
const_iterator2 find2 (int rank, size_type i, size_type j) const;
iterator2 find2 (int rank, size_type i, size_type j);
const_iterator1 find_first1 (int rank, size_type i, size_type j) const;
iterator1 find_first1 (int rank, size_type i, size_type j);
const_iterator1 find_last1 (int rank, size_type i, size_type j) const;
iterator1 find_last1 (int rank, size_type i, size_type j);
const_iterator2 find_first2 (int rank, size_type i, size_type j) const;
iterator2 find_first2 (int rank, size_type i, size_type j);
const_iterator2 find_last2 (int rank, size_type i, size_type j) const;
iterator2 find_last2 (int rank, size_type i, size_type j);

// Iterators simply are indices.

class const_iterator1:
public container_const_reference<banded_adaptor>,
public random_access_iterator_base<const_iterator1, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename banded_adaptor::difference_type difference_type;
typedef typename banded_adaptor::value_type value_type;
typedef typename banded_adaptor::const_reference reference;
typedef typename banded_adaptor::const_pointer pointer;
typedef const_iterator2 dual_iterator_type;
typedef const_reverse_iterator2 dual_reverse_iterator_type;

// Construction and destruction
const_iterator1 ();
const_iterator1 (const banded_adaptor &m, size_type it1, size_type it2);
const_iterator1 (const iterator1 &it);

// Arithmetic
const_iterator1 &operator ++ ();
const_iterator1 &operator -- ();
const_iterator1 &operator += (difference_type n);
const_iterator1 &operator -= (difference_type n);
difference_type operator - (const const_iterator1 &it) const;

// Dereference
reference operator * () const;

const_iterator2 begin () const;
const_iterator2 end () const;
const_reverse_iterator2 rbegin () const;
const_reverse_iterator2 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
const_iterator1 &operator = (const const_iterator1 &it);

// Comparison
bool operator == (const const_iterator1 &it) const;
bool operator < (const const_iterator1 &it) const;
};

const_iterator1 begin1 () const;
const_iterator1 end1 () const;

class iterator1:
public container_reference<banded_adaptor>,
public random_access_iterator_base<iterator1, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename banded_adaptor::difference_type difference_type;
typedef typename banded_adaptor::value_type value_type;
typedef typename banded_adaptor::reference reference;
typedef typename banded_adaptor::pointer pointer;
typedef iterator2 dual_iterator_type;
typedef reverse_iterator2 dual_reverse_iterator_type;

// Construction and destruction
iterator1 ();
iterator1 (banded_adaptor &m, size_type it1, size_type it2);

// Arithmetic
iterator1 &operator ++ ();
iterator1 &operator -- ();
iterator1 &operator += (difference_type n);
iterator1 &operator -= (difference_type n);
difference_type operator - (const iterator1 &it) const;

// Dereference
reference operator * () const;

iterator2 begin () const;
iterator2 end () const;
reverse_iterator2 rbegin () const;
reverse_iterator2 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
iterator1 &operator = (const iterator1 &it);

// Comparison
bool operator == (const iterator1 &it) const;
bool operator < (const iterator1 &it) const;
};

iterator1 begin1 ();
iterator1 end1 ();

class const_iterator2:
public container_const_reference<banded_adaptor>,
public random_access_iterator_base<const_iterator2, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename banded_adaptor::difference_type difference_type;
typedef typename banded_adaptor::value_type value_type;
typedef typename banded_adaptor::const_reference reference;
typedef typename banded_adaptor::const_pointer pointer;
typedef const_iterator1 dual_iterator_type;
typedef const_reverse_iterator1 dual_reverse_iterator_type;

// Construction and destruction
const_iterator2 ();
const_iterator2 (const banded_adaptor &m, size_type it1, size_type it2);
const_iterator2 (const iterator2 &it);

// Arithmetic
const_iterator2 &operator ++ ();
const_iterator2 &operator -- ();
const_iterator2 &operator += (difference_type n);
const_iterator2 &operator -= (difference_type n);
difference_type operator - (const const_iterator2 &it) const;

// Dereference
reference operator * () const;

const_iterator1 begin () const;
const_iterator1 end () const;
const_reverse_iterator1 rbegin () const;
const_reverse_iterator1 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
const_iterator2 &operator = (const const_iterator2 &it);

// Comparison
bool operator == (const const_iterator2 &it) const;
bool operator < (const const_iterator2 &it) const;
};

const_iterator2 begin2 () const;
const_iterator2 end2 () const;

class iterator2:
public container_reference<banded_adaptor>,
public random_access_iterator_base<iterator2, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename banded_adaptor::difference_type difference_type;
typedef typename banded_adaptor::value_type value_type;
typedef typename banded_adaptor::reference reference;
typedef typename banded_adaptor::pointer pointer;
typedef iterator1 dual_iterator_type;
typedef reverse_iterator1 dual_reverse_iterator_type;

// Construction and destruction
iterator2 ();
iterator2 (banded_adaptor &m, size_type it1, size_type it2);

// Arithmetic
iterator2 &operator ++ ();
iterator2 &operator -- ();
iterator2 &operator += (difference_type n);
iterator2 &operator -= (difference_type n);
difference_type operator - (const iterator2 &it) const;

// Dereference
reference operator * () const;

iterator1 begin () const;
iterator1 end () const;
reverse_iterator1 rbegin () const;
reverse_iterator1 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
iterator2 &operator = (const iterator2 &it);

// Comparison
bool operator == (const iterator2 &it) const;
bool operator < (const iterator2 &it) const;
};

iterator2 begin2 ();
iterator2 end2 ();

// Reverse iterators

const_reverse_iterator1 rbegin1 () const;
const_reverse_iterator1 rend1 () const;

reverse_iterator1 rbegin1 ();
reverse_iterator1 rend1 ();

const_reverse_iterator2 rbegin2 () const;
const_reverse_iterator2 rend2 () const;

reverse_iterator2 rbegin2 ();
reverse_iterator2 rend2 ();
};
+ +
+

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: 8/3/2002

+ diff --git a/doc/container.htm b/doc/container.htm index 6c435171..1e4aed8d 100644 --- a/doc/container.htm +++ b/doc/container.htm @@ -1,393 +1,422 @@ + - - - -Container Concepts + + + + + Container Concepts - - - -

c++boost.gifContainer Concepts

- -

Vector

- + + +

c++boost.gif +Container Concepts

+ +

+Vector

+

Description

- -

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

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

- +

Refinement of

- -

Vector Expression.

- + +

Vector Expression +.

+

Associated types

- + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
Value type value_type The type of the vector.
Distance type difference_type A signed integral type used to represent the distance - between two of the vector's iterators.
Size type size_type An unsigned integral type that can represent any - nonnegative value of the vector's distance type.
Value type value_type The type of the vector.
Distance type difference_type A signed integral type used to represent the distance + between two of the vector's iterators.
Size type size_type An unsigned integral type that can represent any nonnegative +value of the vector's distance type.
- +

Notation

- + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
V A 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 -
V A 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 +
- +

Definitions

- +

Valid expressions

- -

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

- + +

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
Insert v.insert (i, t) v is mutable.void
Erase v.erase (i) v is mutable.void
Clear v.clear () v is mutable.void
Resize v.resize (n) v is mutable.void
Name Expression Type requirements Return type
Sizing constructor V v (n)  V
Insert v.insert (i, t) v is mutable.void
Erase v.erase (i) v is mutable.void
Clear v.clear () v is mutable.void
Resize v.resize (n) v is mutable.void
- +

Expression semantics

- -

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

- + +

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 Creates a vector of n elements. v.size () == n.
Insert v.insert (i, t) 0 <= i < v.size () and
- v (i) is a copy of value_type ().
A copy of t is inserted in v. - v (i) is a copy of t.
Erase v.erase (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)  Modifies the vector so that it can hold n - elements. v.size () == n.
Name Expression Precondition Semantics Postcondition
Sizing constructor V v (n) n >= 0 Creates a vector of n elements. v.size () == n.
Insert v.insert (i, t) 0 <= i < v.size () and
+ v (i) is a copy of value_type ().
A copy of t is inserted in v. + v (i) is a copy of t.
Erase v.erase (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)  Modifies the vector so that it can hold n + elements. v.size () == n.
- +

Complexity guarantees

- -

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

- -

The run-time complexity of insert and erase is specific for -the vector.

- + +

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

+ +

The run-time complexity of insert and erase is specific for the vector.

+

Invariants

- +

Models

- + - -

Matrix

- + +

+Matrix

+

Description

- -

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

- + +

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

+

Refinement of

- -

Matrix Expression.

- + +

Matrix Expression +.

+

Associated types

- + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
Value type value_type The type of the matrix.
Distance type difference_type A signed integral type used to represent the distance - between two of the matrix's iterators.
Size type size_type An unsigned integral type that can represent any - nonnegative value of the matrix's distance type.
Value type value_type The type of the matrix.
Distance type difference_type A signed integral type used to represent the distance + between two of the matrix's iterators.
Size type size_type An unsigned integral type that can represent any nonnegative +value of the matrix's distance type.
- +

Notation

- + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
M A 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 -
M A 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 +
- +

Definitions

- +

Valid expressions

- -

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

- + +

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 (i, j, t) m is mutable.void
Erase m.erase (i, j) m is mutable.void
Clear m.clear () m is mutable.void
Resize m.resize (n1, n2) m is mutable.void
Name Expression Type requirements Return type
Sizing constructor M m (n1, n2)  M
Insert m.insert (i, j, t) m is mutable.void
Erase m.erase (i, j) m is mutable.void
Clear m.clear () m is mutable.void
Resize m.resize (n1, n2) m is mutable.void
- +

Expression semantics

- -

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

- + +

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 >= 0Creates a matrix of n1 rows and n2 - columns. m.size1 () == n1 and m.size2 () == - n2.
Insert m.insert (i, j, t) 0 <= i < m.size1 (),
- 0 <= j < m.size2 ()and
- m (i, j)
is a copy of value_type ().
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
- 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 - ().
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)  Modifies the vector so that it can hold n1 rows + Name Expression Precondition Semantics Postcondition
Sizing constructor M m (n1, n2) n1 >= 0 and n2 >= 0Creates a matrix of n1 rows and n2 + columns. m.size1 () == n1 and m.size2 () == + n2.
Insert m.insert (i, j, t) 0 <= i < m.size1 (),
+ 0 <= j < m.size2 ()and
+ m (i, j)
is a copy of value_type ().
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
+ 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 +().
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)  Modifies the vector so that it can hold n1 rows and n2 columns. m.size1 () == n1 and m.size2 () == - n2.
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 and erase is specific for -the matrix.

- + +

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

+ +

The run-time complexity of insert and erase is specific for the matrix.

+

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.

- + +
+

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: 8/3/2002

- + diff --git a/doc/expression.htm b/doc/expression.htm index 1aa6ecf4..675835bb 100644 --- a/doc/expression.htm +++ b/doc/expression.htm @@ -1,1033 +1,1077 @@ + - - - -Expression Concepts + + + + + Expression Concepts - - - -

c++boost.gifExpression Concepts

- -

Scalar Expression

- + + +

c++boost.gif +Expression Concepts

+ +

+Scalar Expression

+

Description

- -

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

- + +

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

+

Refinement of

- +

Default Constructible.

- +

Associated types

- + + - - - - + + + + + +
Value type value_type The type of the scalar expression.
Value type value_type The type of the scalar expression.
- +

Notation

- + + - - - + + + + +
S A type that is a model of Scalar Expression
S A 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.

- + +

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
Name Expression Type requirements Return type
Evaluation operator 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.

- + +

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. 
Name Expression Precondition Semantics Postcondition
Evaluation operator value_type () const    Evaluates the scalar expression. 
- +

Complexity guarantees

- -

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

- + +

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

+

Invariants

- +

Models

- + - -

Vector Expression

- + +

+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.

- + +

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 type value_type The type of the vector expression.
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.
Distance type difference_type A signed integral type used to represent the distance - between two of the vector expression's iterators.
Size type size_type An unsigned integral type that can represent any - nonnegative value of the vector expression's distance - type.
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.
Value type value_type The type of the vector expression.
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.
Distance type difference_type A signed integral type used to represent the distance + between two of the vector expression's iterators.
Size type size_type An unsigned integral type that can represent any nonnegative +value of the vector expression's distance type.
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.
- +

Notation

- + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
V A 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
V A 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.

- + +

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.
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 &
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.
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.

- + +

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.  
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. 
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.  
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.

- + +

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 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 ().
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 ().
- +

Models

- + - -

Matrix Expression

- + +

+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.

- + +

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 type value_type The type of the matrix expression.
Const iterator types const_iterator1 A 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 types iterator1 A 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.
Distance type difference_type A signed integral type used to represent the distance - between two of the matrix expression's iterators.
Size type size_type An unsigned integral type that can represent any - nonnegative value of the matrix expression's distance - type.
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.
Value type value_type The type of the matrix expression.
Const iterator types const_iterator1 A 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 types iterator1 A 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.
Distance type difference_type A signed integral type used to represent the distance + between two of the matrix expression's iterators.
Size type size_type An unsigned integral type that can represent any nonnegative +value of the matrix expression's distance type.
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.
- +

Notation

- + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
M A 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
M A 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.

- + +

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.
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 &
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.
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.

- + +

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 + 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.  
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. 
 
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.

- + +

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 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 + 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 ().
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 ().
- +

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.

- + +
+

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: 8/3/2002

- + diff --git a/doc/hermitian.htm b/doc/hermitian.htm index 8a7abc25..7c115999 100644 --- a/doc/hermitian.htm +++ b/doc/hermitian.htm @@ -1,1208 +1,605 @@ + - - - -Hermitian Matrix + + + + + Hermitian Matrix - - - -

c++boost.gifHermitian Matrix

- -

Hermitian Matrix

- + + +

c++boost.gif + Hermitian Matrix

+ +

+ Hermitian Matrix

+

Description

- -

The templated class hermitian_matrix<T, F1, F2, A> -is the base container adaptor for hermitian matrices. For -a (n x n)-dimensional hermitian matrix and 0 <= i -< n, 0 <= j < n holds hi, -j = hj, i-. -The storage of hermitian matrices is packed.

- + +

The templated class hermitian_matrix<T, F1, F2, A> + is the base container adaptor for hermitian matrices. For a (n x n + )-dimensional hermitian matrix and 0 <= i < n, 0 <= +j < n holds hi, j = h + j, i-. The storage of hermitian matrices +is packed.

+

Example

- -
int main () {
-    using namespace boost::numeric::ublas;
-    hermitian_matrix<std::complex<double>, lower> ml (3, 3);
-    for (int i = 0; i < ml.size1 (); ++ i)
-        for (int j = 0; j <= i; ++ j)
-            ml (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
-    std::cout << ml << std::endl;
-    hermitian_matrix<std::complex<double>, upper> mu (3, 3);
-    for (int i = 0; i < m.size1 (); ++ i)
-        for (int j = i; j < m.size2 (); ++ j)
-            mu (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
-    std::cout << mu << std::endl;
-}
- + +
#include <boost/numeric/ublas/hermitian.hpp>
#include <boost/numeric/ublas/io.hpp>

int main () {
using namespace boost::numeric::ublas;
hermitian_matrix<std::complex<double>, lower> ml (3, 3);
for (unsigned i = 0; i < ml.size1 (); ++ i) {
for (unsigned j = 0; j < i; ++ j)
ml (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
ml (i, i) = std::complex<double> (4 * i, 0);
}
std::cout << ml << std::endl;
hermitian_matrix<std::complex<double>, upper> mu (3, 3);
for (unsigned i = 0; i < mu.size1 (); ++ i) {
mu (i, i) = std::complex<double> (4 * i, 0);
for (unsigned j = i + 1; j < mu.size2 (); ++ j)
mu (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
}
std::cout << mu << std::endl;
}

Definition

- +

Defined in the header hermitian.hpp.

- +

Template parameters

- + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Parameter Description Default
T The type of object stored in the matrix.  
F1Functor describing the type of the hermitian matrix. [1]lower
F2Functor describing the storage organization. [2]row_major
AThe type of the adapted array. [3]unbounded_array<T>
Parameter Description Default
T The type of object stored in the matrix.  
F1Functor describing the type of the hermitian matrix. + [1] + lower
F2Functor describing the storage organization. + [2] + row_major
AThe type of the adapted array. + [3] + unbounded_array<T>
- +

Model of

- -

Matrix.

- + +

Matrix + .

+

Type requirements

- -

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

- + +

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

+

Public base classes

- -

matrix_expression<hermitian_matrix<T, F1, F2, -A> >

- + +

matrix_expression<hermitian_matrix<T, F1, F2, A> > +

+

Members

- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Member Description
hermitian_matrix () Allocates an uninitialized hermitian_matrix - that holds zero rows of zero elements.
hermitian_matrix (size_type size)Allocates an uninitialized hermitian_matrix - that holds size rows of size - elements.
hermitian_matrix (const hermitian_matrix - &m)The copy constructor.
template<class AE>
- hermitian_matrix (const matrix_expression<AE> - &ae)
The extended copy constructor.
void resize (size_type size)Reallocates a hermitian_matrix to hold size - rows of size elements. The content of the hermitian_matrix - is not preserved.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
const_reference operator () (size_type i, - size_type j) constReturns a const reference of the j-th - element in the i-th row.
reference operator () (size_type i, size_type - j)Returns a reference of the j-th element - in the i-th row.
hermitian_matrix &operator = (const - hermitian_matrix &m)The assignment operator.
hermitian_matrix &assign_temporary - (hermitian_matrix &m)Assigns a temporary. May change the hermitian matrix m.
template<class AE>
- hermitian_matrix &operator = (const - matrix_expression<AE> &ae)
The extended assignment operator.
template<class AE>
- hermitian_matrix &assign (const - matrix_expression<AE> &ae)
Assigns a matrix expression to the hermitian matrix. - Left and right hand side of the assignment should be - independent.
template<class AE>
- hermitian_matrix &operator += (const - matrix_expression<AE> &ae)
A computed assignment operator. Adds the matrix - expression to the hermitian matrix.
template<class AE>
- hermitian_matrix &plus_assign (const - matrix_expression<AE> &ae)
Adds a matrix expression to the hermitian matrix. - Left and right hand side of the assignment should be - independent.
template<class AE>
- hermitian_matrix &operator -= (const - matrix_expression<AE> &ae)
A computed assignment operator. Subtracts the matrix - expression from the hermitian matrix.
template<class AE>
- hermitian_matrix &minus_assign (const - matrix_expression<AE> &ae)
Subtracts a matrix expression from the hermitian - matrix. Left and right hand side of the assignment should - be independent.
template<class AT>
- hermitian_matrix &operator *= (const AT &at)
A computed assignment operator. Multiplies the - hermitian matrix with a scalar.
template<class AT>
- hermitian_matrix &operator /= (const AT &at)
A computed assignment operator. Divides the hermitian - matrix through a scalar.
void swap (hermitian_matrix &m)Swaps the contents of the hermitian matrices.
void insert (size_type i, size_type j, - const_reference t)Inserts the value t at the j-th - element of the i-th row.
void erase (size_type i, size_type j)Erases the value at the j-th elemenst of - the i-th row.
void clear ()Clears the matrix.
const_iterator1 begin1 () constReturns a const_iterator1 pointing to - the beginning of the hermitian_matrix.
const_iterator1 end1 () constReturns a const_iterator1 pointing to - the end of the hermitian_matrix.
iterator1 begin1 () Returns a iterator1 pointing to the - beginning of the hermitian_matrix.
iterator1 end1 () Returns a iterator1 pointing to the end - of the hermitian_matrix.
const_iterator2 begin2 () constReturns a const_iterator2 pointing to - the beginning of the hermitian_matrix.
const_iterator2 end2 () constReturns a const_iterator2 pointing to - the end of the hermitian_matrix.
iterator2 begin2 () Returns a iterator2 pointing to the - beginning of the hermitian_matrix.
iterator2 end2 () Returns a iterator2 pointing to the end - of the hermitian_matrix.
const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 - pointing to the beginning of the reversed hermitian_matrix. -
const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 - pointing to the end of the reversed hermitian_matrix. -
reverse_iterator1 rbegin1 () Returns a reverse_iterator1 pointing to - the beginning of the reversed hermitian_matrix. -
reverse_iterator1 rend1 () Returns a reverse_iterator1 pointing to - the end of the reversed hermitian_matrix.
const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 - pointing to the beginning of the reversed hermitian_matrix. -
const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 - pointing to the end of the reversed hermitian_matrix. -
reverse_iterator2 rbegin2 () Returns a reverse_iterator2 pointing to - the beginning of the reversed hermitian_matrix. -
reverse_iterator2 rend2 () Returns a reverse_iterator2 pointing to - the end of the reversed hermitian_matrix.
Member Description
hermitian_matrix () Allocates an uninitialized hermitian_matrix + that holds zero rows of zero elements.
hermitian_matrix (size_type size)Allocates an uninitialized hermitian_matrix + that holds size rows of size elements.
hermitian_matrix (const hermitian_matrix &m)The copy constructor.
template<class AE>
+ hermitian_matrix (const matrix_expression<AE> &ae)
The extended copy constructor.
void resize (size_type size)Reallocates a hermitian_matrix to hold size + rows of size elements. The content of the hermitian_matrix + is not preserved.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
const_reference operator () (size_type i, size_type +j) constReturns a const reference of the j + -th element in the i-th row.
reference operator () (size_type i, size_type + j)Returns a reference of the j-th element + in the i-th row.
hermitian_matrix &operator = (const hermitian_matrix +&m)The assignment operator.
hermitian_matrix &assign_temporary (hermitian_matrix +&m)Assigns a temporary. May change the hermitian matrix +m .
template<class AE>
+ hermitian_matrix &operator = (const matrix_expression<AE> +&ae)
The extended assignment operator.
template<class AE>
+ hermitian_matrix &assign (const matrix_expression<AE> +&ae)
Assigns a matrix expression to the hermitian matrix. + Left and right hand side of the assignment should be independent.
template<class AE>
+ hermitian_matrix &operator += (const matrix_expression<AE> +&ae)
A computed assignment operator. Adds the matrix expression +to the hermitian matrix.
template<class AE>
+ hermitian_matrix &plus_assign (const matrix_expression<AE> +&ae)
Adds a matrix expression to the hermitian matrix. Left +and right hand side of the assignment should be independent.
template<class AE>
+ hermitian_matrix &operator -= (const matrix_expression<AE> +&ae)
A computed assignment operator. Subtracts the matrix + expression from the hermitian matrix.
template<class AE>
+ hermitian_matrix &minus_assign (const matrix_expression<AE> +&ae)
Subtracts a matrix expression from the hermitian matrix. +Left and right hand side of the assignment should be independent.
template<class AT>
+ hermitian_matrix &operator *= (const AT &at)
A computed assignment operator. Multiplies the hermitian +matrix with a scalar.
template<class AT>
+ hermitian_matrix &operator /= (const AT &at)
A computed assignment operator. Divides the hermitian + matrix through a scalar.
void swap (hermitian_matrix &m)Swaps the contents of the hermitian matrices.
void insert (size_type i, size_type j, const_reference +t)Inserts the value t at the j-th + element of the i-th row.
void erase (size_type i, size_type j)Erases the value at the j-th elemenst of + the i-th row.
void clear ()Clears the matrix.
const_iterator1 begin1 () constReturns a const_iterator1 pointing to +the beginning of the hermitian_matrix.
const_iterator1 end1 () constReturns a const_iterator1 pointing to +the end of the hermitian_matrix.
iterator1 begin1 () Returns a iterator1 pointing to the beginning +of the hermitian_matrix.
iterator1 end1 () Returns a iterator1 pointing to the end + of the hermitian_matrix.
const_iterator2 begin2 () constReturns a const_iterator2 pointing to +the beginning of the hermitian_matrix.
const_iterator2 end2 () constReturns a const_iterator2 pointing to +the end of the hermitian_matrix.
iterator2 begin2 () Returns a iterator2 pointing to the beginning +of the hermitian_matrix.
iterator2 end2 () Returns a iterator2 pointing to the end + of the hermitian_matrix.
const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing +to the beginning of the reversed hermitian_matrix.
const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing +to the end of the reversed hermitian_matrix.
reverse_iterator1 rbegin1 () Returns a reverse_iterator1 pointing to + the beginning of the reversed hermitian_matrix.
reverse_iterator1 rend1 () Returns a reverse_iterator1 pointing to + the end of the reversed hermitian_matrix.
const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing +to the beginning of the reversed hermitian_matrix.
const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing +to the end of the reversed hermitian_matrix.
reverse_iterator2 rbegin2 () Returns a reverse_iterator2 pointing to + the beginning of the reversed hermitian_matrix.
reverse_iterator2 rend2 () Returns a reverse_iterator2 pointing to + the end of the reversed hermitian_matrix.
- +

Notes

- -

[1] Supported parameters for -the type of the hermitian matrix are lower and upper.

- -

[2] Supported parameters for -the storage organization are row_major and column_major.

- -

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

- + +

[1] + Supported parameters for the type of the hermitian matrix are lower + and upper.

+ +

[2] + Supported parameters for the storage organization are row_major + and column_major.

+ +

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

+

Interface

- -
    // Array based hermitian matrix class
-    template<class T, class F1, class F2, class A>
-    class hermitian_matrix:
-        public matrix_expression<hermitian_matrix<T, F1, F2, A> > {
-    public:
-        typedef std::size_t size_type;
-        typedef std::ptrdiff_t difference_type;
-        typedef T value_type;
-        typedef const T const_reference;
-        typedef T &reference;
-        typedef const T *const_pointer;
-        typedef T *pointer;
-        typedef F1 functor1_type;
-        typedef F2 functor2_type;
-        typedef A array_type;
-        typedef const A const_array_type;
-        typedef const hermitian_matrix<T, F1, F2, A> const_self_type;
-        typedef hermitian_matrix<T, F1, F2, A> self_type;
-        typedef const matrix_const_reference<const_self_type> const_closure_type;
-        typedef matrix_reference<self_type> closure_type;
-        typedef packed_tag storage_category;
-        typedef typename F1::packed_category packed_category;
-        typedef typename F2::orientation_category orientation_category;
-
-        // Construction and destruction
-        hermitian_matrix ();
-        hermitian_matrix (size_type size);
-        hermitian_matrix (size_type size1, size_type size2);
-        hermitian_matrix (const hermitian_matrix &m);
-        template<class AE>
-        hermitian_matrix (const matrix_expression<AE> &ae);
-
-        // Accessors
-        size_type size1 () const;
-        size_type size2 () const;
-        const_array_type &data () const;
-        array_type &data ();
-
-        // Resizing
-        void resize (size_type size);
-        void resize (size_type size1, size_type size2);
-
-        // Element access
-        const_reference operator () (size_type i, size_type j) const;
-        reference operator () (size_type i, size_type j);
-
-        // Assignment
-        hermitian_matrix &operator = (const hermitian_matrix &m);
-        hermitian_matrix &assign_temporary (hermitian_matrix &m);
-        template<class AE>
-        hermitian_matrix &operator = (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_matrix &reset (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_matrix &assign (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_matrix& operator += (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_matrix &plus_assign (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_matrix& operator -= (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_matrix &minus_assign (const matrix_expression<AE> &ae);
-        template<class AT>
-        hermitian_matrix& operator *= (const AT &at);
-        template<class AT>
-        hermitian_matrix& operator /= (const AT &at);
-
-        // Swapping
-        void swap (hermitian_matrix &m);
-        friend void swap (hermitian_matrix &m1, hermitian_matrix &m2);
-
-        // Element insertion and erasure
-        void insert (size_type i, size_type j, const_reference t);
-        void erase (size_type i, size_type j);
-        void clear ();
-
-        class const_iterator1;
-        class iterator1;
-        class const_iterator2;
-        class iterator2;
-        typedef reverse_iterator_base1<const_iterator1> const_reverse_iterator1;
-        typedef reverse_iterator_base1<iterator1> reverse_iterator1;
-        typedef reverse_iterator_base2<const_iterator2> const_reverse_iterator2;
-        typedef reverse_iterator_base2<iterator2> reverse_iterator2;
-
-        // Element lookup
-        const_iterator1 find_first1 (int rank, size_type i, size_type j) const;
-        iterator1 find_first1 (int rank, size_type i, size_type j);
-        const_iterator1 find_last1 (int rank, size_type i, size_type j) const;
-        iterator1 find_last1 (int rank, size_type i, size_type j);
-        const_iterator2 find_first2 (int rank, size_type i, size_type j) const;
-        iterator2 find_first2 (int rank, size_type i, size_type j);
-        const_iterator2 find_last2 (int rank, size_type i, size_type j) const;
-        iterator2 find_last2 (int rank, size_type i, size_type j);
-
-        // Iterators simply are indices.
-
-        class const_iterator1:
-            public container_const_reference<hermitian_matrix>,
-            public random_access_iterator_base<const_iterator1, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename hermitian_matrix::difference_type difference_type;
-            typedef typename hermitian_matrix::value_type value_type;
-            typedef typename hermitian_matrix::const_reference reference;
-            typedef typename hermitian_matrix::const_pointer pointer;
-            typedef const_iterator2 dual_iterator_type;
-            typedef const_reverse_iterator2 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            const_iterator1 ();
-            const_iterator1 (const hermitian_matrix &m, size_type it1, size_type it2);
-            const_iterator1 (const iterator1 &it);
-
-            // Arithmetic
-            const_iterator1 &operator ++ ();
-            const_iterator1 &operator -- ();
-            const_iterator1 &operator += (difference_type n);
-            const_iterator1 &operator -= (difference_type n);
-            difference_type operator - (const const_iterator1 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            const_iterator2 begin () const;
-            const_iterator2 end () const;
-            const_reverse_iterator2 rbegin () const;
-            const_reverse_iterator2 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            const_iterator1 &operator = (const const_iterator1 &it);
-
-            // Comparison
-            bool operator == (const const_iterator1 &it) const;
-            bool operator < (const const_iterator1 &it) const;
-        };
-
-        const_iterator1 begin1 () const;
-        const_iterator1 end1 () const;
-
-        class iterator1:
-            public container_reference<hermitian_matrix>,
-            public random_access_iterator_base<iterator1, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename hermitian_matrix::difference_type difference_type;
-            typedef typename hermitian_matrix::value_type value_type;
-            typedef typename hermitian_matrix::reference reference;
-            typedef typename hermitian_matrix::pointer pointer;
-            typedef iterator2 dual_iterator_type;
-            typedef reverse_iterator2 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            iterator1 ();
-            iterator1 (hermitian_matrix &m, size_type it1, size_type it2);
-
-            // Arithmetic
-            iterator1 &operator ++ ();
-            iterator1 &operator -- ();
-            iterator1 &operator += (difference_type n);
-            iterator1 &operator -= (difference_type n);
-            difference_type operator - (const iterator1 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            iterator2 begin () const;
-            iterator2 end () const;
-            reverse_iterator2 rbegin () const;
-            reverse_iterator2 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            iterator1 &operator = (const iterator1 &it);
-
-            // Comparison
-            bool operator == (const iterator1 &it) const;
-            bool operator < (const iterator1 &it) const;
-        };
-
-        iterator1 begin1 ();
-        iterator1 end1 ();
-
-        class const_iterator2:
-            public container_const_reference<hermitian_matrix>,
-            public random_access_iterator_base<const_iterator2, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename hermitian_matrix::difference_type difference_type;
-            typedef typename hermitian_matrix::value_type value_type;
-            typedef typename hermitian_matrix::const_reference reference;
-            typedef typename hermitian_matrix::const_pointer pointer;
-            typedef const_iterator1 dual_iterator_type;
-            typedef const_reverse_iterator1 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            const_iterator2 ();
-            const_iterator2 (const hermitian_matrix &m, size_type it1, size_type it2);
-            const_iterator2 (const iterator2 &it);
-
-            // Arithmetic
-            const_iterator2 &operator ++ ();
-            const_iterator2 &operator -- ();
-            const_iterator2 &operator += (difference_type n);
-            const_iterator2 &operator -= (difference_type n);
-            difference_type operator - (const const_iterator2 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            const_iterator1 begin () const;
-            const_iterator1 end () const;
-            const_reverse_iterator1 rbegin () const;
-            const_reverse_iterator1 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            const_iterator2 &operator = (const const_iterator2 &it);
-
-            // Comparison
-            bool operator == (const const_iterator2 &it) const;
-            bool operator < (const const_iterator2 &it) const;
-        };
-
-        const_iterator2 begin2 () const;
-        const_iterator2 end2 () const;
-
-        class iterator2:
-            public container_reference<hermitian_matrix>,
-            public random_access_iterator_base<iterator2, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename hermitian_matrix::difference_type difference_type;
-            typedef typename hermitian_matrix::value_type value_type;
-            typedef typename hermitian_matrix::reference reference;
-            typedef typename hermitian_matrix::pointer pointer;
-            typedef iterator1 dual_iterator_type;
-            typedef reverse_iterator1 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            iterator2 ();
-            iterator2 (hermitian_matrix &m, size_type it1, size_type it2);
-
-            // Arithmetic
-            iterator2 &operator ++ ();
-            iterator2 &operator -- ();
-            iterator2 &operator += (difference_type n);
-            iterator2 &operator -= (difference_type n);
-            difference_type operator - (const iterator2 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            iterator1 begin () const;
-            iterator1 end () const;
-            reverse_iterator1 rbegin () const;
-            reverse_iterator1 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            iterator2 &operator = (const iterator2 &it);
-
-            // Comparison
-            bool operator == (const iterator2 &it) const;
-            bool operator < (const iterator2 &it) const;
-        };
-
-        iterator2 begin2 ();
-        iterator2 end2 ();
-
-        // Reverse iterators
-
-        const_reverse_iterator1 rbegin1 () const;
-        const_reverse_iterator1 rend1 () const;
-
-        reverse_iterator1 rbegin1 ();
-        reverse_iterator1 rend1 ();
-
-        const_reverse_iterator2 rbegin2 () const;
-        const_reverse_iterator2 rend2 () const;
-
-        reverse_iterator2 rbegin2 ();
-        reverse_iterator2 rend2 ();
-    };
- -

Hermitian Adaptor

- + +
    // Array based hermitian matrix class
template<class T, class F1, class F2, class A>
class hermitian_matrix:
public matrix_expression<hermitian_matrix<T, F1, F2, A> > {
public:
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T value_type;
typedef const T const_reference;
typedef T &reference;
typedef const T *const_pointer;
typedef T *pointer;
typedef F1 functor1_type;
typedef F2 functor2_type;
typedef A array_type;
typedef const A const_array_type;
typedef const hermitian_matrix<T, F1, F2, A> const_self_type;
typedef hermitian_matrix<T, F1, F2, A> self_type;
typedef const matrix_const_reference<const_self_type> const_closure_type;
typedef matrix_reference<self_type> closure_type;
typedef packed_tag storage_category;
typedef typename F1::packed_category packed_category;
typedef typename F2::orientation_category orientation_category;

// Construction and destruction
hermitian_matrix ();
hermitian_matrix (size_type size);
hermitian_matrix (size_type size1, size_type size2);
hermitian_matrix (const hermitian_matrix &m);
template<class AE>
hermitian_matrix (const matrix_expression<AE> &ae);

// Accessors
size_type size1 () const;
size_type size2 () const;
const_array_type &data () const;
array_type &data ();

// Resizing
void resize (size_type size);
void resize (size_type size1, size_type size2);

// Element access
const_reference operator () (size_type i, size_type j) const;
reference operator () (size_type i, size_type j);

// Assignment
hermitian_matrix &operator = (const hermitian_matrix &m);
hermitian_matrix &assign_temporary (hermitian_matrix &m);
template<class AE>
hermitian_matrix &operator = (const matrix_expression<AE> &ae);
template<class AE>
hermitian_matrix &reset (const matrix_expression<AE> &ae);
template<class AE>
hermitian_matrix &assign (const matrix_expression<AE> &ae);
template<class AE>
hermitian_matrix& operator += (const matrix_expression<AE> &ae);
template<class AE>
hermitian_matrix &plus_assign (const matrix_expression<AE> &ae);
template<class AE>
hermitian_matrix& operator -= (const matrix_expression<AE> &ae);
template<class AE>
hermitian_matrix &minus_assign (const matrix_expression<AE> &ae);
template<class AT>
hermitian_matrix& operator *= (const AT &at);
template<class AT>
hermitian_matrix& operator /= (const AT &at);

// Swapping
void swap (hermitian_matrix &m);
friend void swap (hermitian_matrix &m1, hermitian_matrix &m2);

// Element insertion and erasure
void insert (size_type i, size_type j, const_reference t);
void erase (size_type i, size_type j);
void clear ();

class const_iterator1;
class iterator1;
class const_iterator2;
class iterator2;
typedef reverse_iterator_base1<const_iterator1> const_reverse_iterator1;
typedef reverse_iterator_base1<iterator1> reverse_iterator1;
typedef reverse_iterator_base2<const_iterator2> const_reverse_iterator2;
typedef reverse_iterator_base2<iterator2> reverse_iterator2;

// Element lookup
const_iterator1 find_first1 (int rank, size_type i, size_type j) const;
iterator1 find_first1 (int rank, size_type i, size_type j);
const_iterator1 find_last1 (int rank, size_type i, size_type j) const;
iterator1 find_last1 (int rank, size_type i, size_type j);
const_iterator2 find_first2 (int rank, size_type i, size_type j) const;
iterator2 find_first2 (int rank, size_type i, size_type j);
const_iterator2 find_last2 (int rank, size_type i, size_type j) const;
iterator2 find_last2 (int rank, size_type i, size_type j);

// Iterators simply are indices.

class const_iterator1:
public container_const_reference<hermitian_matrix>,
public random_access_iterator_base<const_iterator1, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename hermitian_matrix::difference_type difference_type;
typedef typename hermitian_matrix::value_type value_type;
typedef typename hermitian_matrix::const_reference reference;
typedef typename hermitian_matrix::const_pointer pointer;
typedef const_iterator2 dual_iterator_type;
typedef const_reverse_iterator2 dual_reverse_iterator_type;

// Construction and destruction
const_iterator1 ();
const_iterator1 (const hermitian_matrix &m, size_type it1, size_type it2);
const_iterator1 (const iterator1 &it);

// Arithmetic
const_iterator1 &operator ++ ();
const_iterator1 &operator -- ();
const_iterator1 &operator += (difference_type n);
const_iterator1 &operator -= (difference_type n);
difference_type operator - (const const_iterator1 &it) const;

// Dereference
reference operator * () const;

const_iterator2 begin () const;
const_iterator2 end () const;
const_reverse_iterator2 rbegin () const;
const_reverse_iterator2 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
const_iterator1 &operator = (const const_iterator1 &it);

// Comparison
bool operator == (const const_iterator1 &it) const;
bool operator < (const const_iterator1 &it) const;
};

const_iterator1 begin1 () const;
const_iterator1 end1 () const;

class iterator1:
public container_reference<hermitian_matrix>,
public random_access_iterator_base<iterator1, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename hermitian_matrix::difference_type difference_type;
typedef typename hermitian_matrix::value_type value_type;
typedef typename hermitian_matrix::reference reference;
typedef typename hermitian_matrix::pointer pointer;
typedef iterator2 dual_iterator_type;
typedef reverse_iterator2 dual_reverse_iterator_type;

// Construction and destruction
iterator1 ();
iterator1 (hermitian_matrix &m, size_type it1, size_type it2);

// Arithmetic
iterator1 &operator ++ ();
iterator1 &operator -- ();
iterator1 &operator += (difference_type n);
iterator1 &operator -= (difference_type n);
difference_type operator - (const iterator1 &it) const;

// Dereference
reference operator * () const;

iterator2 begin () const;
iterator2 end () const;
reverse_iterator2 rbegin () const;
reverse_iterator2 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
iterator1 &operator = (const iterator1 &it);

// Comparison
bool operator == (const iterator1 &it) const;
bool operator < (const iterator1 &it) const;
};

iterator1 begin1 ();
iterator1 end1 ();

class const_iterator2:
public container_const_reference<hermitian_matrix>,
public random_access_iterator_base<const_iterator2, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename hermitian_matrix::difference_type difference_type;
typedef typename hermitian_matrix::value_type value_type;
typedef typename hermitian_matrix::const_reference reference;
typedef typename hermitian_matrix::const_pointer pointer;
typedef const_iterator1 dual_iterator_type;
typedef const_reverse_iterator1 dual_reverse_iterator_type;

// Construction and destruction
const_iterator2 ();
const_iterator2 (const hermitian_matrix &m, size_type it1, size_type it2);
const_iterator2 (const iterator2 &it);

// Arithmetic
const_iterator2 &operator ++ ();
const_iterator2 &operator -- ();
const_iterator2 &operator += (difference_type n);
const_iterator2 &operator -= (difference_type n);
difference_type operator - (const const_iterator2 &it) const;

// Dereference
reference operator * () const;

const_iterator1 begin () const;
const_iterator1 end () const;
const_reverse_iterator1 rbegin () const;
const_reverse_iterator1 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
const_iterator2 &operator = (const const_iterator2 &it);

// Comparison
bool operator == (const const_iterator2 &it) const;
bool operator < (const const_iterator2 &it) const;
};

const_iterator2 begin2 () const;
const_iterator2 end2 () const;

class iterator2:
public container_reference<hermitian_matrix>,
public random_access_iterator_base<iterator2, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename hermitian_matrix::difference_type difference_type;
typedef typename hermitian_matrix::value_type value_type;
typedef typename hermitian_matrix::reference reference;
typedef typename hermitian_matrix::pointer pointer;
typedef iterator1 dual_iterator_type;
typedef reverse_iterator1 dual_reverse_iterator_type;

// Construction and destruction
iterator2 ();< +br> iterator2 (hermitian_matrix &m, size_type it1, size_type it2);

// Arithmetic
iterator2 &operator ++ ();
iterator2 &operator -- ();
iterator2 &operator += (difference_type n);
iterator2 &operator -= (difference_type n);
difference_type operator - (const iterator2 &it) const;

// Dereference
reference operator * () const;

iterator1 begin () const;
iterator1 end () const;
reverse_iterator1 rbegin () const;
reverse_iterator1 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
iterator2 &operator = (const iterator2 &it);

// Comparison
bool operator == (const iterator2 &it) const;
bool operator < (const iterator2 &it) const;
};

iterator2 begin2 ();
iterator2 end2 ();

// Reverse iterators

const_reverse_iterator1 rbegin1 () const;
const_reverse_iterator1 rend1 () const;

reverse_iterator1 rbegin1 ();
reverse_iterator1 rend1 ();

const_reverse_iterator2 rbegin2 () const;
const_reverse_iterator2 rend2 () const;

reverse_iterator2 rbegin2 ();
reverse_iterator2 rend2 ();
};
+ +

+ Hermitian Adaptor

+

Description

- -

The templated class hermitian_adaptor<M, F> is -a hermitian matrix adaptor for other matrices.

- + +

The templated class hermitian_adaptor<M, F> is a hermitian +matrix adaptor for other matrices.

+

Example

- -
int main () {
-    using namespace boost::numeric::ublas;
-    matrix<std::complex<double> > m (3, 3);
-    hermitian_adaptor<matrix<std::complex<double> >, lower> hal (m);
-    for (int i = 0; i < hal.size1 (); ++ i)
-        for (int j = 0; j <= i; ++ j)
-            hal (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
-    std::cout << hal << std::endl;
-    hermitian_adaptor<matrix<std::complex<double> >, upper> hau (m);
-    for (int i = 0; i < hau.size1 (); ++ i)
-        for (int j = i; j < hau.size2 (); ++ j)
-            hau (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
-    std::cout << sau << std::endl;
-}
- + +
#include <boost/numeric/ublas/hermitian.hpp>
#include <boost/numeric/ublas/io.hpp>

int main () {
using namespace boost::numeric::ublas;
matrix<std::complex<double> > m (3, 3);
hermitian_adaptor<matrix<std::complex<double> >, lower> hal (m);
for (unsigned i = 0; i < hal.size1 (); ++ i) {
for (unsigned j = 0; j < i; ++ j)
hal (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
hal (i, i) = std::complex<double> (4 * i, 0);
}
std::cout << hal << std::endl;
hermitian_adaptor<matrix<std::complex<double> >, upper> hau (m);
for (unsigned i = 0; i < hau.size1 (); ++ i) {
hau (i, i) = std::complex<double> (4 * i, 0);
for (unsigned j = i + 1; j < hau.size2 (); ++ j)
hau (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
}
std::cout << hau << std::endl;
}

Definition

- +

Defined in the header hermitian.hpp.

- +

Template parameters

- + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
Parameter Description Default
MThe type of the adapted matrix. 
FFunctor describing the type of the hermitian adaptor. - [1]lower
Parameter Description Default
MThe type of the adapted matrix. 
FFunctor describing the type of the hermitian adaptor. + [1] + lower
- +

Model of

- -

Matrix Expression. -

- + +

Matrix Expression + .

+

Type requirements

- -

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

- + +

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

+

Public base classes

- -

matrix_expression<hermitian_adaptor<M, F> > -

- + +

matrix_expression<hermitian_adaptor<M, F> >

+

Members

- + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Member Description
hermitian_adaptor () Constructs a hermitian_adaptor that - holds zero rows of zero elements.
hermitian_adaptor (matrix_type &data)Constructs a hermitian_adaptor of a - matrix.
hermitian_adaptor (const hermitian_adaptor - &m)The copy constructor.
template<class AE>
- hermitian_adaptor (const matrix_expression<AE> - &ae)
The extended copy constructor.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
const_reference operator () (size_type i, - size_type j) constReturns a const reference of the j-th - element in the i-th row.
reference operator () (size_type i, size_type - j)Returns a reference of the j-th element - in the i-th row.
hermitian_adaptor &operator = (const - hermitian_adaptor &m)The assignment operator.
hermitian_adaptor &assign_temporary - (hermitian_adaptor &m)Assigns a temporary. May change the hermitian adaptor - m.
template<class AE>
- hermitian_adaptor &operator = (const - matrix_expression<AE> &ae)
The extended assignment operator.
template<class AE>
- hermitian_adaptor &assign (const - matrix_expression<AE> &ae)
Assigns a matrix expression to the hermitian adaptor. - Left and right hand side of the assignment should be - independent.
template<class AE>
- hermitian_adaptor &operator += (const - matrix_expression<AE> &ae)
A computed assignment operator. Adds the matrix - expression to the hermitian adaptor.
template<class AE>
- hermitian_adaptor &plus_assign (const - matrix_expression<AE> &ae)
Adds a matrix expression to the hermitian adaptor. - Left and right hand side of the assignment should be - independent.
template<class AE>
- hermitian_adaptor &operator -= (const - matrix_expression<AE> &ae)
A computed assignment operator. Subtracts the matrix - expression from the hermitian adaptor.
template<class AE>
- hermitian_adaptor &minus_assign (const - matrix_expression<AE> &ae)
Subtracts a matrix expression from the hermitian - adaptor. Left and right hand side of the assignment - should be independent.
template<class AT>
- hermitian_adaptor &operator *= (const AT &at)
A computed assignment operator. Multiplies the - hermitian adaptor with a scalar.
template<class AT>
- hermitian_adaptor &operator /= (const AT &at)
A computed assignment operator. Divides the hermitian - adaptor through a scalar.
void swap (hermitian_adaptor &m)Swaps the contents of the hermitian adaptors.
const_iterator1 begin1 () constReturns a const_iterator1 pointing to - the beginning of the hermitian_adaptor.
const_iterator1 end1 () constReturns a const_iterator1 pointing to - the end of the hermitian_adaptor.
iterator1 begin1 () Returns a iterator1 pointing to the - beginning of the hermitian_adaptor.
iterator1 end1 () Returns a iterator1 pointing to the end - of the hermitian_adaptor.
const_iterator2 begin2 () constReturns a const_iterator2 pointing to - the beginning of the hermitian_adaptor.
const_iterator2 end2 () constReturns a const_iterator2 pointing to - the end of the hermitian_adaptor.
iterator2 begin2 () Returns a iterator2 pointing to the - beginning of the hermitian_adaptor.
iterator2 end2 () Returns a iterator2 pointing to the end - of the hermitian_adaptor.
const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 - pointing to the beginning of the reversed hermitian_adaptor. -
const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 - pointing to the end of the reversed hermitian_adaptor. -
reverse_iterator1 rbegin1 () Returns a reverse_iterator1 pointing to - the beginning of the reversed hermitian_adaptor. -
reverse_iterator1 rend1 () Returns a reverse_iterator1 pointing to - the end of the reversed hermitian_adaptor.
const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 - pointing to the beginning of the reversed hermitian_adaptor. -
const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 - pointing to the end of the reversed hermitian_adaptor. -
reverse_iterator2 rbegin2 () Returns a reverse_iterator2 pointing to - the beginning of the reversed hermitian_adaptor. -
reverse_iterator2 rend2 () Returns a reverse_iterator2 pointing to - the end of the reversed hermitian_adaptor.
Member Description
hermitian_adaptor () Constructs a hermitian_adaptor that holds +zero rows of zero elements.
hermitian_adaptor (matrix_type &data)Constructs a hermitian_adaptor of a matrix.
hermitian_adaptor (const hermitian_adaptor &m)The copy constructor.
template<class AE>
+ hermitian_adaptor (const matrix_expression<AE> &ae)
The extended copy constructor.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
const_reference operator () (size_type i, size_type +j) constReturns a const reference of the j + -th element in the i-th row.
reference operator () (size_type i, size_type + j)Returns a reference of the j-th element + in the i-th row.
hermitian_adaptor &operator = (const hermitian_adaptor +&m)The assignment operator.
hermitian_adaptor &assign_temporary (hermitian_adaptor +&m)Assigns a temporary. May change the hermitian adaptor + m.
template<class AE>
+ hermitian_adaptor &operator = (const matrix_expression<AE> +&ae)
The extended assignment operator.
template<class AE>
+ hermitian_adaptor &assign (const matrix_expression<AE> +&ae)
Assigns a matrix expression to the hermitian adaptor. + Left and right hand side of the assignment should be independent.
template<class AE>
+ hermitian_adaptor &operator += (const matrix_expression<AE> +&ae)
A computed assignment operator. Adds the matrix expression +to the hermitian adaptor.
template<class AE>
+ hermitian_adaptor &plus_assign (const matrix_expression<AE> +&ae)
Adds a matrix expression to the hermitian adaptor. +Left and right hand side of the assignment should be independent.
template<class AE>
+ hermitian_adaptor &operator -= (const matrix_expression<AE> +&ae)
A computed assignment operator. Subtracts the matrix + expression from the hermitian adaptor.
template<class AE>
+ hermitian_adaptor &minus_assign (const matrix_expression<AE> +&ae)
Subtracts a matrix expression from the hermitian adaptor. +Left and right hand side of the assignment should be independent.
template<class AT>
+ hermitian_adaptor &operator *= (const AT &at)
A computed assignment operator. Multiplies the hermitian +adaptor with a scalar.
template<class AT>
+ hermitian_adaptor &operator /= (const AT &at)
A computed assignment operator. Divides the hermitian + adaptor through a scalar.
void swap (hermitian_adaptor &m)Swaps the contents of the hermitian adaptors.
const_iterator1 begin1 () constReturns a const_iterator1 pointing to +the beginning of the hermitian_adaptor.
const_iterator1 end1 () constReturns a const_iterator1 pointing to +the end of the hermitian_adaptor.
iterator1 begin1 () Returns a iterator1 pointing to the beginning +of the hermitian_adaptor.
iterator1 end1 () Returns a iterator1 pointing to the end + of the hermitian_adaptor.
const_iterator2 begin2 () constReturns a const_iterator2 pointing to +the beginning of the hermitian_adaptor.
const_iterator2 end2 () constReturns a const_iterator2 pointing to +the end of the hermitian_adaptor.
iterator2 begin2 () Returns a iterator2 pointing to the beginning +of the hermitian_adaptor.
iterator2 end2 () Returns a iterator2 pointing to the end + of the hermitian_adaptor.
const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing +to the beginning of the reversed hermitian_adaptor. +
const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing +to the end of the reversed hermitian_adaptor.
reverse_iterator1 rbegin1 () Returns a reverse_iterator1 pointing to + the beginning of the reversed hermitian_adaptor.
reverse_iterator1 rend1 () Returns a reverse_iterator1 pointing to + the end of the reversed hermitian_adaptor.
const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing +to the beginning of the reversed hermitian_adaptor. +
const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing +to the end of the reversed hermitian_adaptor.
reverse_iterator2 rbegin2 () Returns a reverse_iterator2 pointing to + the beginning of the reversed hermitian_adaptor.
reverse_iterator2 rend2 () Returns a reverse_iterator2 pointing to + the end of the reversed hermitian_adaptor.
- +

Notes

- -

[1] Supported parameters -for the type of the hermitian adaptor are lower and upper.

- + +

[1] + Supported parameters for the type of the hermitian adaptor are lower + and upper.

+

Interface

- -
    // Hermitian matrix adaptor class
-    template<class M, class F>
-    class hermitian_adaptor:
-        public matrix_expression<hermitian_adaptor<M, F> > {
-    public:
-        typedef const M const_matrix_type;
-        typedef M matrix_type;
-        typedef F functor_type;
-        typedef typename M::size_type size_type;
-        typedef typename M::difference_type difference_type;
-        typedef typename M::value_type value_type;
-        typedef typename M::value_type const_reference;
-        typedef typename M::reference reference;
-        typedef typename M::const_pointer const_pointer;
-        typedef typename M::pointer pointer;
-        typedef const hermitian_adaptor<M, F> const_self_type;
-        typedef hermitian_adaptor<M, F> self_type;
-        typedef const matrix_const_reference<const_self_type> const_closure_type;
-        typedef matrix_reference<self_type> closure_type;
-        typedef typename storage_restrict_traits<typename M::storage_category,
-                                                 packed_proxy_tag>::storage_category storage_category;
-        typedef typename F::packed_category packed_category;
-        typedef typename M::orientation_category orientation_category;
-
-        // Construction and destruction
-        hermitian_adaptor ();
-        hermitian_adaptor (matrix_type &data);
-        hermitian_adaptor (const hermitian_adaptor &m);
-
-        // Accessors
-        size_type size1 () const;
-        size_type size2 () const;
-        const_matrix_type &data () const;
-        matrix_type &data ();
-
-        // Element access
-        const_reference operator () (size_type i, size_type j) const;
-        reference operator () (size_type i, size_type j);
-
-        // Assignment
-        hermitian_adaptor &operator = (const hermitian_adaptor &m);
-        hermitian_adaptor &assign_temporary (hermitian_adaptor &m);
-        template<class AE>
-        hermitian_adaptor &operator = (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_adaptor &assign (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_adaptor& operator += (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_adaptor &plus_assign (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_adaptor& operator -= (const matrix_expression<AE> &ae);
-        template<class AE>
-        hermitian_adaptor &minus_assign (const matrix_expression<AE> &ae);
-        template<class AT>
-        hermitian_adaptor& operator *= (const AT &at);
-        template<class AT>
-        hermitian_adaptor& operator /= (const AT &at);
-
-        // Swapping
-        void swap (hermitian_adaptor &m);
-        friend void swap (hermitian_adaptor &m1, hermitian_adaptor &m2);
-
-        class const_iterator1;
-        class iterator1;
-        class const_iterator2;
-        class iterator2;
-        typedef reverse_iterator_base1<const_iterator1> const_reverse_iterator1;
-        typedef reverse_iterator_base1<iterator1> reverse_iterator1;
-        typedef reverse_iterator_base2<const_iterator2> const_reverse_iterator2;
-        typedef reverse_iterator_base2<iterator2> reverse_iterator2;
-
-        // Element lookup
-        const_iterator1 find_first1 (int rank, size_type i, size_type j) const;
-        iterator1 find_first1 (int rank, size_type i, size_type j);
-        const_iterator1 find_last1 (int rank, size_type i, size_type j) const;
-        iterator1 find_last1 (int rank, size_type i, size_type j);
-        const_iterator2 find_first2 (int rank, size_type i, size_type j) const;
-        iterator2 find_first2 (int rank, size_type i, size_type j);
-        const_iterator2 find_last2 (int rank, size_type i, size_type j) const;
-        iterator2 find_last2 (int rank, size_type i, size_type j);
-
-        // Iterators simply are indices.
-
-        class const_iterator1:
-            public container_const_reference<hermitian_adaptor>,
-            public random_access_iterator_base<const_iterator1, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename hermitian_adaptor::difference_type difference_type;
-            typedef typename hermitian_adaptor::value_type value_type;
-            typedef typename hermitian_adaptor::const_reference reference;
-            typedef typename hermitian_adaptor::const_pointer pointer;
-            typedef const_iterator2 dual_iterator_type;
-            typedef const_reverse_iterator2 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            const_iterator1 ();
-            const_iterator1 (const hermitian_adaptor &m, size_type it1, size_type it2);
-            const_iterator1 (const iterator1 &it);
-
-            // Arithmetic
-            const_iterator1 &operator ++ ();
-            const_iterator1 &operator -- ();
-            const_iterator1 &operator += (difference_type n);
-            const_iterator1 &operator -= (difference_type n);
-            difference_type operator - (const const_iterator1 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            const_iterator2 begin () const;
-            const_iterator2 end () const;
-            const_reverse_iterator2 rbegin () const;
-            const_reverse_iterator2 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            const_iterator1 &operator = (const const_iterator1 &it);
-
-            // Comparison
-            bool operator == (const const_iterator1 &it) const;
-            bool operator < (const const_iterator1 &it) const;
-        };
-
-        const_iterator1 begin1 () const;
-        const_iterator1 end1 () const;
-
-        class iterator1:
-            public container_reference<hermitian_adaptor>,
-            public random_access_iterator_base<iterator1, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename hermitian_adaptor::difference_type difference_type;
-            typedef typename hermitian_adaptor::value_type value_type;
-            typedef typename hermitian_adaptor::reference reference;
-            typedef typename hermitian_adaptor::pointer pointer;
-            typedef iterator2 dual_iterator_type;
-            typedef reverse_iterator2 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            iterator1 ();
-            iterator1 (hermitian_adaptor &m, size_type it1, size_type it2);
-
-            // Arithmetic
-            iterator1 &operator ++ ();
-            iterator1 &operator -- ();
-            iterator1 &operator += (difference_type n);
-            iterator1 &operator -= (difference_type n);
-            difference_type operator - (const iterator1 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            iterator2 begin () const;
-            iterator2 end () const;
-            reverse_iterator2 rbegin () const;
-            reverse_iterator2 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            iterator1 &operator = (const iterator1 &it);
-
-            // Comparison
-            bool operator == (const iterator1 &it) const;
-            bool operator < (const iterator1 &it) const;
-        };
-
-        iterator1 begin1 ();
-        iterator1 end1 ();
-
-        class const_iterator2:
-            public container_const_reference<hermitian_adaptor>,
-            public random_access_iterator_base<const_iterator2, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename hermitian_adaptor::difference_type difference_type;
-            typedef typename hermitian_adaptor::value_type value_type;
-            typedef typename hermitian_adaptor::const_reference reference;
-            typedef typename hermitian_adaptor::const_pointer pointer;
-            typedef const_iterator1 dual_iterator_type;
-            typedef const_reverse_iterator1 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            const_iterator2 ();
-            const_iterator2 (const hermitian_adaptor &m, size_type it1, size_type it2);
-            const_iterator2 (const iterator2 &it);
-
-            // Arithmetic
-            const_iterator2 &operator ++ ();
-            const_iterator2 &operator -- ();
-            const_iterator2 &operator += (difference_type n);
-            const_iterator2 &operator -= (difference_type n);
-            difference_type operator - (const const_iterator2 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            const_iterator1 begin () const;
-            const_iterator1 end () const;
-            const_reverse_iterator1 rbegin () const;
-            const_reverse_iterator1 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            const_iterator2 &operator = (const const_iterator2 &it);
-
-            // Comparison
-            bool operator == (const const_iterator2 &it) const;
-            bool operator < (const const_iterator2 &it) const;
-        };
-
-        const_iterator2 begin2 () const;
-        const_iterator2 end2 () const;
-
-        class iterator2:
-            public container_reference<hermitian_adaptor>,
-            public random_access_iterator_base<iterator2, value_type> {
-        public:
-            typedef packed_random_access_iterator_tag iterator_category;
-            typedef typename hermitian_adaptor::difference_type difference_type;
-            typedef typename hermitian_adaptor::value_type value_type;
-            typedef typename hermitian_adaptor::reference reference;
-            typedef typename hermitian_adaptor::pointer pointer;
-            typedef iterator1 dual_iterator_type;
-            typedef reverse_iterator1 dual_reverse_iterator_type;
-
-            // Construction and destruction
-            iterator2 ();
-            iterator2 (hermitian_adaptor &m, size_type it1, size_type it2);
-
-            // Arithmetic
-            iterator2 &operator ++ ();
-            iterator2 &operator -- ();
-            iterator2 &operator += (difference_type n);
-            iterator2 &operator -= (difference_type n);
-            difference_type operator - (const iterator2 &it) const;
-
-            // Dereference
-            reference operator * () const;
-
-            iterator1 begin () const;
-            iterator1 end () const;
-            reverse_iterator1 rbegin () const;
-            reverse_iterator1 rend () const;
-
-            // Indices
-            size_type index1 () const;
-            size_type index2 () const;
-
-            // Assignment
-            iterator2 &operator = (const iterator2 &it);
-
-            // Comparison
-            bool operator == (const iterator2 &it) const;
-            bool operator <(const iterator2 &it) const;
-        };
-
-        iterator2 begin2 ();
-        iterator2 end2 ();
-
-        // Reverse iterators
-
-        const_reverse_iterator1 rbegin1 () const;
-        const_reverse_iterator1 rend1 () const;
-
-        reverse_iterator1 rbegin1 ();
-        reverse_iterator1 rend1 ();
-
-        const_reverse_iterator2 rbegin2 () const;
-        const_reverse_iterator2 rend2 () const;
-
-        reverse_iterator2 rbegin2 ();
-        reverse_iterator2 rend2 ();
-    };
- -
- -

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.

- + +
    // Hermitian matrix adaptor class
template<class M, class F>
class hermitian_adaptor:
public matrix_expression<hermitian_adaptor<M, F> > {
public:
typedef const M const_matrix_type;
typedef M matrix_type;
typedef F functor_type;
typedef typename M::size_type size_type;
typedef typename M::difference_type difference_type;
typedef typename M::value_type value_type;
typedef typename M::value_type const_reference;
typedef typename M::reference reference;
typedef typename M::const_pointer const_pointer;
typedef typename M::pointer pointer;
typedef const hermitian_adaptor<M, F> const_self_type;
typedef hermitian_adaptor<M, F> self_type;
typedef const matrix_const_reference<const_self_type> const_closure_type;
typedef matrix_reference<self_type> closure_type;
typedef typename storage_restrict_traits<typename M::storage_category,
packed_proxy_tag>::storage_category storage_category;
typedef typename F::packed_category packed_category;
typedef typename M::orientation_category orientation_category;

// Construction and destruction
hermitian_adaptor ();
hermitian_adaptor (matrix_type &data);
hermitian_adaptor (const hermitian_adaptor &m);

// Accessors
size_type size1 () const;
size_type size2 () const;
const_matrix_type &data () const;
matrix_type &data ();

// Element access
const_reference operator () (size_type i, size_type j) const;
reference operator () (size_type i, size_type j);

// Assignment
hermitian_adaptor &operator = (const hermitian_adaptor &m);
hermitian_adaptor &assign_temporary (hermitian_adaptor &m);
template<class AE>
hermitian_adaptor &operator = (const matrix_expression<AE> &ae);
template<class AE>
hermitian_adaptor &assign (const matrix_expression<AE> &ae);
template<class AE>
hermitian_adaptor& operator += (const matrix_expression<AE> &ae);
template<class AE>
hermitian_adaptor &plus_assign (const matrix_expression<AE> &ae);
template<class AE>
hermitian_adaptor& operator -= (const matrix_expression<AE> &ae);
template<class AE>
hermitian_adaptor &minus_assign (const matrix_expression<AE> &ae);
template<class AT>
hermitian_adaptor& operator *= (const AT &at);
template<class AT>
hermitian_adaptor& operator /= (const AT &at);

// Swapping
void swap (hermitian_adaptor &m);
friend void swap (hermitian_adaptor &m1, hermitian_adaptor &m2);

class const_iterator1;
class iterator1;
class const_iterator2;
class iterator2;
typedef reverse_iterator_base1<const_iterator1> const_reverse_iterator1;
typedef reverse_iterator_base1<iterator1> reverse_iterator1;
typedef reverse_iterator_base2<const_iterator2> const_reverse_iterator2;
typedef reverse_iterator_base2<iterator2> reverse_iterator2;

// Element lookup
const_iterator1 find_first1 (int rank, size_type i, size_type j) const;
iterator1 find_first1 (int rank, size_type i, size_type j);
const_iterator1 find_last1 (int rank, size_type i, size_type j) const;
iterator1 find_last1 (int rank, size_type i, size_type j);
const_iterator2 find_first2 (int rank, size_type i, size_type j) const;
iterator2 find_first2 (int rank, size_type i, size_type j);
const_iterator2 find_last2 (int rank, size_type i, size_type j) const;
iterator2 find_last2 (int rank, size_type i, size_type j);

// Iterators simply are indices.

class const_iterator1:
public container_const_reference<hermitian_adaptor>,
public random_access_iterator_base<const_iterator1, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename hermitian_adaptor::difference_type difference_type;
typedef typename hermitian_adaptor::value_type value_type;
typedef typename hermitian_adaptor::const_reference reference;
typedef typename hermitian_adaptor::const_pointer pointer;
typedef const_iterator2 dual_iterator_type;
typedef const_reverse_iterator2 dual_reverse_iterator_type;

// Construction and destruction
const_iterator1 ();
const_iterator1 (const hermitian_adaptor &m, size_type it1, size_type it2);
const_iterator1 (const iterator1 &it);

// Arithmetic
const_iterator1 &operator ++ ();
const_iterator1 &operator -- ();
const_iterator1 &operator += (difference_type n);
const_iterator1 &operator -= (difference_type n);
difference_type operator - (const const_iterator1 &it) const;

// Dereference
reference operator * () const;

const_iterator2 begin () const;
const_iterator2 end () const;
const_reverse_iterator2 rbegin () const;
const_reverse_iterator2 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
const_iterator1 &operator = (const const_iterator1 &it);

// Comparison
bool operator == (const const_iterator1 &it) const;
bool operator < (const const_iterator1 &it) const;
};

const_iterator1 begin1 () const;
const_iterator1 end1 () const;

class iterator1:
public container_reference<hermitian_adaptor>,
public random_access_iterator_base<iterator1, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename hermitian_adaptor::difference_type difference_type;
typedef typename hermitian_adaptor::value_type value_type;
typedef typename hermitian_adaptor::reference reference;
typedef typename hermitian_adaptor::pointer pointer;
typedef iterator2 dual_iterator_type;
typedef reverse_iterator2 dual_reverse_iterator_type;

// Construction and destruction
iterator1 ();
iterator1 (hermitian_adaptor &m, size_type it1, size_type it2);

// Arithmetic
iterator1 &operator ++ ();
iterator1 &operator -- ();
iterator1 &operator += (difference_type n);
iterator1 &operator -= (difference_type n);
difference_type operator - (const iterator1 &it) const;

// Dereference
reference operator * () const;

iterator2 begin () const;
iterator2 end () const;
reverse_iterator2 rbegin () const;
reverse_iterator2 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
iterator1 &operator = (const iterator1 &it);

// Comparison
bool operator == (const iterator1 &it) const;
bool operator < (const iterator1 &it) const;
};

iterator1 begin1 ();
iterator1 end1 ();

class const_iterator2:
public container_const_reference<hermitian_adaptor>,
public random_access_iterator_base<const_iterator2, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename hermitian_adaptor::difference_type difference_type;
typedef typename hermitian_adaptor::value_type value_type;
typedef typename hermitian_adaptor::const_reference reference;
typedef typename hermitian_adaptor::const_pointer pointer;
typedef const_iterator1 dual_iterator_type;
typedef const_reverse_iterator1 dual_reverse_iterator_type;

// Construction and destruction
const_iterator2 ();
const_iterator2 (const hermitian_adaptor &m, size_type it1, size_type it2);
const_iterator2 (const iterator2 &it);

// Arithmetic
const_iterator2 &operator ++ ();
const_iterator2 &operator -- ();
const_iterator2 &operator += (difference_type n);
const_iterator2 &operator -= (difference_type n);
difference_type operator - (const const_iterator2 &it) const;

// Dereference
reference operator * () const;

const_iterator1 begin () const;
const_iterator1 end () const;
const_reverse_iterator1 rbegin () const;
const_reverse_iterator1 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
const_iterator2 &operator = (const const_iterator2 &it);

// Comparison
bool operator == (const const_iterator2 &it) const;
bool operator < (const const_iterator2 &it) const;
};

const_iterator2 begin2 () const;
const_iterator2 end2 () const;

class iterator2:
public container_reference<hermitian_adaptor>,
public random_access_iterator_base<iterator2, value_type> {
public:
typedef packed_random_access_iterator_tag iterator_category;
typedef typename hermitian_adaptor::difference_type difference_type;
typedef typename hermitian_adaptor::value_type value_type;
typedef typename hermitian_adaptor::reference reference;
typedef typename hermitian_adaptor::pointer pointer;
typedef iterator1 dual_iterator_type;
typedef reverse_iterator1 dual_reverse_iterator_type;

// Construction and destruction
iterator2 ();
iterator2 (hermitian_adaptor &m, size_type it1, size_type it2);

// Arithmetic
iterator2 &operator ++ ();
iterator2 &operator -- ();
iterator2 &operator += (difference_type n);
iterator2 &operator -= (difference_type n);
difference_type operator - (const iterator2 &it) const;

// Dereference
reference operator * () const;

iterator1 begin () const;
iterator1 end () const;
reverse_iterator1 rbegin () const;
reverse_iterator1 rend () const;

// Indices
size_type index1 () const;
size_type index2 () const;

// Assignment
iterator2 &operator = (const iterator2 &it);

// Comparison
bool operator == (const iterator2 &it) const;
bool operator <(const iterator2 &it) const;< +br> };

iterator2 begin2 ();
iterator2 end2 ();

// Reverse iterators

const_reverse_iterator1 rbegin1 () const;
const_reverse_iterator1 rend1 () const;

reverse_iterator1 rbegin1 ();
reverse_iterator1 rend1 ();

const_reverse_iterator2 rbegin2 () const;
const_reverse_iterator2 rend2 () const;

reverse_iterator2 rbegin2 ();
reverse_iterator2 rend2 ();
};
+ +
+

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: 8/3/2002

+ diff --git a/doc/index.htm b/doc/index.htm index fa0a6674..0ac63a58 100644 --- a/doc/index.htm +++ b/doc/index.htm @@ -1,324 +1,400 @@ + - - - -Boost Basic Linear Algebra + + + + + Boost Basic Linear Algebra - - - -

c++boost.gif Basic Linear Algebra

- -

uBLAS is a C++ template class library that provides BLAS level 1, 2, 3 -functionality for dense, packed and sparse matrices. The design -and implementation unify mathematical notation via operator -overloading and efficient code generation via expression -templates.

- + + +

c++boost.gif + Basic Linear Algebra

+ +

uBLAS is a C++ template class library that provides + BLAS + level 1, 2, 3 functionality for dense, packed and sparse matrices. The +design and implementation unify mathematical notation via operator overloading +and efficient code generation via expression templates.

+

Functionality

- -

uBLAS provides templated C++ classes for dense, unit and -sparse vectors, dense, identity, triangular, banded, symmetric, -hermitian and sparse matrices. Views into vectors and matrices -can be constructed via ranges or slices and adaptor classes. The -library covers the usual basic linear algebra operations on -vectors and matrices: reductions like different norms, addition -and subtraction of vectors and matrices and multiplication with a -scalar, inner and outer products of vectors, matrix vector and -matrix matrix products and triangular solver. The glue between -containers, views and expression templated operations is a mostly -STL conforming iterator -interface.

- -

Dense, packed and sparse matrix classes are being tested with the CLAPACK test suite.

- + +

uBLAS provides templated C++ classes for dense, unit and sparse vectors, +dense, identity, triangular, banded, symmetric, hermitian and sparse matrices. +Views into vectors and matrices can be constructed via ranges or slices and +adaptor classes. The library covers the usual basic linear algebra operations +on vectors and matrices: reductions like different norms, addition and subtraction +of vectors and matrices and multiplication with a scalar, inner and outer +products of vectors, matrix vector and matrix matrix products and triangular +solver. The glue between containers, views and expression templated operations +is a mostly STL + conforming iterator interface.

+ +

Dense, packed and sparse matrix classes are being tested with the + CLAPACK + test suite.

+

Known limitations:

- -