Symmetric Matrix
Symmetric Matrix
Description
The templated class symmetric_matrix<T, F1, F2, A>
is the base
container adaptor for symmetric matrices. For a (n x n )-dimensional
symmetric matrix and 0 < = i < n, 0 < = j < n holds si,j=
sj,i. The storage of symmetric matrices is packed.
Example
#include <boost/numeric/ublas/symmetric.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
symmetric_matrix<double, lower> ml (3, 3);
for (unsigned i = 0; i < ml.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
ml (i, j) = 3 * i + j;
std::cout << ml << std::endl;
symmetric_matrix<double, upper> mu (3, 3);
for (unsigned i = 0; i < mu.size1 (); ++ i)
for (unsigned j = i; j < mu.size2 (); ++ j)
mu (i, j) = 3 * i + j;
std::cout << mu << std::endl;
}
Definition
Defined in the header symmetric.hpp.
Template parameters
Parameter | Description | Default |
---|---|---|
|
The type of object stored in the matrix. |
|
|
Functor describing the type of the symmetric 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<symmetric_matrix<T, F1, F2, A> >
Members
Member | Description |
---|---|
|
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 symmetric matrix |
|
The extended assignment operator. |
|
Assigns a matrix expression to the symmetric matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Adds the matrix expression to the symmetric matrix. |
|
Adds a matrix expression to the symmetric matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Subtracts the matrix expression from the symmetric matrix. |
|
Subtracts a matrix expression from the symmetric matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Multiplies the symmetric matrix with a scalar. |
|
A computed assignment operator. Divides the symmetric matrix through a scalar. |
|
Swaps the contents of the symmetric 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
symmetric 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>
.
Symmetric Adaptor
Description
The templated class symmetric_adaptor<M, F>
is a symmetric matrix
adaptor for other matrices.
Example
#include <boost/numeric/ublas/symmetric.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
symmetric_adaptor<matrix<double>, lower> sal (m);
for (unsigned i = 0; i < sal.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
sal (i, j) = 3 * i + j;
std::cout << sal << std::endl;
symmetric_adaptor<matrix<double>, upper> sau (m);
for (unsigned i = 0; i < sau.size1 (); ++ i)
for (unsigned j = i; j < sau.size2 (); ++ j)
sau (i, j) = 3 * i + j;
std::cout << sau << std::endl;
}
Definition
Defined in the header symmetric.hpp.
Template parameters
Parameter | Description | Default |
---|---|---|
|
The type of the adapted matrix. |
|
|
Functor describing the type of the symmetric adaptor. [1] |
|
Model of
Type requirements
None, except for those imposed by the requirements of Matrix Expression .
Public base classes
matrix_expression<symmetric_adaptor<M, F> >
Members
Member | Description |
---|---|
|
Constructs a |
|
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 symmetric adaptor |
|
The extended assignment operator. |
|
Assigns a matrix expression to the symmetric adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Adds the matrix expression to the symmetric adaptor. |
|
Adds a matrix expression to the symmetric adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Subtracts the matrix expression from the symmetric adaptor. |
|
Subtracts a matrix expression from the symmetric adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Multiplies the symmetric adaptor with a scalar. |
|
A computed assignment operator. Divides the symmetric adaptor through a scalar. |
|
Swaps the contents of the symmetric 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
symmetric 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 ).