The templated class triangular_matrix<T, F1, F2, A>
is the base
container adaptor for triangular matrices. For a (n x n )-dimensional
lower triangular matrix and 0 < = i < n, 0 < = j < n holds ti,j
= 0 , if i > j. If furthermore holds ti,i= 1 the matrix
is called unit lower triangular. For a (n x n )-dimensional lower
triangular matrix and 0 < = i < n, 0 < = j < n holds ti,j=
0 , if i < j. If furthermore holds ti,i= 1 the matrix is
called unit lower triangular. The storage of triangular matrices is
packed.
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
triangular_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;
triangular_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;
}
Please read the full triangular example for more details.
Parameter | Description | Default |
---|---|---|
|
The type of object stored in the matrix. |
|
|
Functor describing the type of the triangular matrix. [1] |
|
|
Functor describing the storage organization. [2] |
|
|
The type of the adapted array. [3] |
|
Matrix .
None, except for those imposed by the requirements of Matrix .
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 triangular matrix |
|
The extended assignment operator. |
|
Assigns a matrix expression to the triangular matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Adds the matrix expression to the triangular matrix. |
|
Adds a matrix expression to the triangular matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Subtracts the matrix expression from the triangular matrix. |
|
Subtracts a matrix expression from the triangular matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Multiplies the triangular matrix with a scalar. |
|
A computed assignment operator. Divides the triangular matrix through a scalar. |
|
Swaps the contents of the triangular 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 |
[1] Supported parameters for the type of the
triangular matrix are lower
, unit_lower
, upper
and unit_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>
.
The templated class triangular_adaptor<M, F>
is a triangular matrix
adaptor for other matrices.
#include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
triangular_adaptor<matrix<double>, lower> tal (m);
for (unsigned i = 0; i < tal.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
tal (i, j) = 3 * i + j;
std::cout << tal << std::endl;
triangular_adaptor<matrix<double>, upper> tau (m);
for (unsigned i = 0; i < tau.size1 (); ++ i)
for (unsigned j = i; j < tau.size2 (); ++ j)
tau (i, j) = 3 * i + j;
std::cout << tau << std::endl;
}
Please read the full triangular example for more details.
Parameter | Description | Default |
---|---|---|
|
The type of the adapted matrix. |
|
|
Functor describing the type of the triangular adaptor. [1] |
|
None, except for those imposed by the requirements of Matrix Expression .
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 triangular adaptor |
|
The extended assignment operator. |
|
Assigns a matrix expression to the triangular adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Adds the matrix expression to the triangular adaptor. |
|
Adds a matrix expression to the triangular adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Subtracts the matrix expression from the triangular adaptor. |
|
Subtracts a matrix expression from the triangular adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Multiplies the triangular adaptor with a scalar. |
|
A computed assignment operator. Divides the triangular adaptor through a scalar. |
|
Swaps the contents of the triangular 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 |
[1] Supported parameters for the type of the
triangular adaptor are lower
, unit_lower
, upper
and unit_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 ).