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 = h j, i-. The storage of hermitian matrices is packed.

Example

#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.  
F1 Functor describing the type of the hermitian matrix. [1] lower
F2 Functor describing the storage organization. [2] row_major
A The type of the adapted array. [3] unbounded_array<T>

Model of

Matrix .

Type requirements

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

Public base classes

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 () const Returns the number of rows.
size_type size2 () const Returns the number of columns.
const_reference operator () (size_type i, size_type j) const Returns 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 () const Returns a const_iterator1 pointing to the beginning of the hermitian_matrix.
const_iterator1 end1 () const Returns 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 () const Returns a const_iterator2 pointing to the beginning of the hermitian_matrix.
const_iterator2 end2 () const Returns 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 () const Returns a const_reverse_iterator1 pointing to the beginning of the reversed hermitian_matrix.
const_reverse_iterator1 rend1 () const Returns 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 () const Returns a const_reverse_iterator2 pointing to the beginning of the reversed hermitian_matrix.
const_reverse_iterator2 rend2 () const Returns 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> .

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

Example

#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
M The type of the adapted matrix.  
F Functor describing the type of the hermitian adaptor. [1] lower

Model of

Matrix Expression .

Type requirements

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

Public base classes

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 () const Returns the number of rows.
size_type size2 () const Returns the number of columns.
const_reference operator () (size_type i, size_type j) const Returns 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 () const Returns a const_iterator1 pointing to the beginning of the hermitian_adaptor.
const_iterator1 end1 () const Returns 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 () const Returns a const_iterator2 pointing to the beginning of the hermitian_adaptor.
const_iterator2 end2 () const Returns 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 () const Returns a const_reverse_iterator1 pointing to the beginning of the reversed hermitian_adaptor.
const_reverse_iterator1 rend1 () const Returns 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 () const Returns a const_reverse_iterator2 pointing to the beginning of the reversed hermitian_adaptor.
const_reverse_iterator2 rend2 () const Returns 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.

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;< 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: 1/15/2003