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.
Example
#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 |
---|---|---|
|
The type of object stored in the matrix. |
|
|
Functor describing the storage organization. [1] |
|
|
The type of the adapted array. [2] |
|
Model of
Matrix .
Type requirements
None, except for those imposed by the requirements of Matrix .
Public base classes
matrix_container<banded_matrix<T, F, 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 the number of diagonals below the main diagonal. |
|
Returns the number of diagonals above the main diagonal. |
|
Returns
a |
|
Returns a reference
of the |
|
The assignment operator. |
|
Assigns a
temporary. May change the banded matrix |
|
The extended assignment operator. |
|
Assigns a matrix expression to the banded matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Adds the matrix expression to the banded matrix. |
|
Adds a matrix expression to the banded matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Subtracts the matrix expression from the banded matrix. |
|
Subtracts a matrix expression from the banded matrix. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Multiplies the banded matrix with a scalar. |
|
A computed assignment operator. Divides the banded matrix through a scalar. |
|
Swaps the contents of the banded 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 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>
.
Banded Adaptor
Description
The templated class banded_adaptor<M>
is a banded matrix adaptor for
other matrices.
Example
#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 |
|
The type of the adapted matrix. |
Model of
Type requirements
None, except for those imposed by the requirements of Matrix Expression .
Public base classes
matrix_expression<banded_adaptor<M> >
Members
Member | Description |
---|---|
|
Constructs a |
|
The copy constructor. |
|
The extended copy constructor. |
|
Returns the number of rows. |
|
Returns the number of columns. |
|
Returns the number of diagonals below the main diagonal. |
|
Returns the number of diagonals above the main diagonal. |
|
Returns
a |
|
Returns a reference
of the |
|
The assignment operator. |
|
Assigns a
temporary. May change the banded adaptor |
|
The extended assignment operator. |
|
Assigns a matrix expression to the banded adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Adds the matrix expression to the banded adaptor. |
|
Adds a matrix expression to the banded adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Subtracts the matrix expression from the banded adaptor. |
|
Subtracts a matrix expression from the banded adaptor. Left and right hand side of the assignment should be independent. |
|
A computed assignment operator. Multiplies the banded adaptor with a scalar. |
|
A computed assignment operator. Divides the banded adaptor through a scalar. |
|
Swaps the contents of the banded 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 |
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).