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.
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 |
---|---|---|
|
The type of object stored in the matrix. |
|
|
Functor describing the type of the hermitian matrix. [1] |
|
|
Functor describing the storage organization. [2] |
|
|
The type of the adapted array. [3] |
|
Model of
Matrix .
Type requirements
None, except for those imposed by the requirements of Matrix .
Public base classes
matrix_container<hermitian_matrix<T, F1, F2, A> >
Members
Member | Description |
---|---|
|
Allocates an uninitialized |
|
Allocates an uninitialized
|
|
The copy constructor. |
|
The extended copy constructor. |
|
Reallocates a
|
|
Returns the number of rows. |
|
Returns the number of columns. |
|
Returns
a |
|
Returns a reference
of the |
|
The assignment operator. |
|
Assigns a
temporary. May change the hermitian matrix |
|
The extended assignment operator. |
|
Assigns a matrix expression to the hermitian matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Adds the matrix expression to the hermitian matrix. |
|
Adds a matrix expression to the hermitian matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Subtracts the matrix expression from the hermitian matrix. |
|
Subtracts a matrix expression from the hermitian matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Multiplies the hermitian matrix with a scalar. |
|
A computed assignment operator. Divides the hermitian matrix through a scalar. |
|
Swaps the contents of the hermitian matrices. |
|
Inserts
the value |
|
Erases the value at the |
|
Clears the matrix. |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a
|
|
Returns a
|
|
Returns a |
|
Returns a |
|
Returns a
|
|
Returns a
|
|
Returns a |
|
Returns a |
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>
.
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 |
---|---|---|
|
The type of the adapted matrix. |
|
|
Functor describing the type of the hermitian adaptor. [1] |
|
Model of
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 |
---|---|
|
Constructs a
|
|
The copy constructor. |
|
The extended copy constructor. |
|
Returns the number of rows. |
|
Returns the number of columns. |
|
Returns
a |
|
Returns a reference
of the |
|
The assignment operator. |
|
Assigns a
temporary. May change the hermitian adaptor |
|
The extended assignment operator. |
|
Assigns a matrix expression to the hermitian adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Adds the matrix expression to the hermitian adaptor. |
|
Adds a matrix expression to the hermitian adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Subtracts the matrix expression from the hermitian adaptor. |
|
Subtracts a matrix expression from the hermitian adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Multiplies the hermitian adaptor with a scalar. |
|
A computed assignment operator. Divides the hermitian adaptor through a scalar. |
|
Swaps the contents of the hermitian adaptors. |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a |
|
Returns a
|
|
Returns a
|
|
Returns a |
|
Returns a |
|
Returns a
|
|
Returns a
|
|
Returns a |
|
Returns a |
Notes
[1] Supported parameters for the type of the
hermitian adaptor are lower
and upper
.
Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
Copyright (©) 2021 Shikhar Vashistha
Use, modification and distribution are subject to the Boost Software
License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt ).