From 76a6b7a6ee9bd1aa4024e4e12ef5705fa300599b Mon Sep 17 00:00:00 2001 From: rainmaker6 Date: Mon, 7 Jun 2021 11:34:38 +0530 Subject: [PATCH] GSoC21 Concerting HTML Documentation to AsciiDoc 2021 Shikhar Vashistha --- doc/.gitignore | 2 + doc/Jamfile | 30 + doc/banded.html | 580 ------- doc/blas.html | 452 ------ doc/bounded_array.html | 219 --- doc/container_concept.html | 629 -------- doc/expression_concept.html | 1074 ------------- doc/hermitian.html | 597 ------- doc/index.html | 432 ----- doc/iterator_concept.html | 1168 -------------- doc/js/jquery-1.3.2.min.js | 19 - doc/js/jquery.toc-gw.js | 166 -- doc/matrix.html | 768 --------- doc/matrix_expression.html | 1428 ----------------- doc/matrix_proxy.html | 1428 ----------------- doc/matrix_sparse.html | 983 ------------ doc/operations_overview.html | 277 ---- doc/options.html | 247 --- doc/overview.html | 965 ----------- doc/products.html | 318 ---- doc/range.html | 229 --- doc/release_notes.html | 110 -- doc/storage_concept.html | 157 -- doc/storage_sparse.html | 288 ---- doc/symmetric.html | 588 ------- doc/tensor.html | 652 -------- doc/tensor/extents.html | 250 --- doc/tensor/strides.html | 238 --- doc/tensor/tensor_expression.html | 272 ---- doc/tensor/tensor_index.html | 262 --- doc/triangular.html | 602 ------- doc/types_overview.html | 608 ------- doc/ublas-docinfo-footer.html | 7 + doc/ublas.adoc | 86 + doc/ublas.css | 59 - doc/ublas/banded.adoc | 394 +++++ doc/ublas/blas.adoc | 230 +++ doc/ublas/bounded_array.adoc | 146 ++ doc/ublas/container_concept.adoc | 395 +++++ doc/ublas/expression_concept.adoc | 604 +++++++ doc/ublas/hermitian.adoc | 409 +++++ doc/ublas/index.adoc | 230 +++ doc/ublas/iterator_concept.adoc | 639 ++++++++ doc/ublas/matrix.adoc | 552 +++++++ doc/ublas/matrix_expression.adoc | 1313 +++++++++++++++ doc/ublas/matrix_proxy.adoc | 1144 +++++++++++++ doc/ublas/matrix_sparse.adoc | 660 ++++++++ doc/ublas/operations_overview.adoc | 283 ++++ doc/ublas/options.adoc | 188 +++ doc/ublas/overview.adoc | 582 +++++++ doc/ublas/products.adoc | 200 +++ doc/ublas/range.adoc | 191 +++ doc/ublas/release_notes.adoc | 80 + doc/{ => ublas}/samples/Jamfile.v2 | 0 .../samples/assignment_examples.cpp | 0 doc/{ => ublas}/samples/banded_adaptor.cpp | 0 doc/{ => ublas}/samples/banded_matrix.cpp | 0 doc/{ => ublas}/samples/bounded_array.cpp | 0 doc/{ => ublas}/samples/compressed_matrix.cpp | 0 doc/{ => ublas}/samples/compressed_vector.cpp | 0 doc/{ => ublas}/samples/coordinate_matrix.cpp | 0 doc/{ => ublas}/samples/coordinate_vector.cpp | 0 doc/{ => ublas}/samples/ex_triangular.cpp | 0 doc/{ => ublas}/samples/hermitian_adaptor.cpp | 0 doc/{ => ublas}/samples/hermitian_matrix.cpp | 0 doc/{ => ublas}/samples/identity_matrix.cpp | 0 doc/{ => ublas}/samples/map_array.cpp | 0 doc/{ => ublas}/samples/mapped_matrix.cpp | 0 doc/{ => ublas}/samples/mapped_vector.cpp | 0 doc/{ => ublas}/samples/matrix.cpp | 0 doc/{ => ublas}/samples/matrix_binary.cpp | 0 .../samples/matrix_binary_scalar.cpp | 0 doc/{ => ublas}/samples/matrix_column.cpp | 0 .../samples/matrix_column_project.cpp | 0 .../samples/matrix_matrix_binary.cpp | 0 .../samples/matrix_matrix_solve.cpp | 0 doc/{ => ublas}/samples/matrix_range.cpp | 0 .../samples/matrix_range_project.cpp | 0 doc/{ => ublas}/samples/matrix_row.cpp | 0 .../samples/matrix_row_project.cpp | 0 doc/{ => ublas}/samples/matrix_slice.cpp | 0 .../samples/matrix_slice_project.cpp | 0 doc/{ => ublas}/samples/matrix_unary.cpp | 0 .../samples/matrix_vector_binary.cpp | 0 .../samples/matrix_vector_range.cpp | 0 .../samples/matrix_vector_slice.cpp | 0 .../samples/matrix_vector_solve.cpp | 0 doc/{ => ublas}/samples/range.cpp | 0 doc/{ => ublas}/samples/slice.cpp | 0 doc/{ => ublas}/samples/symmetric_adaptor.cpp | 0 doc/{ => ublas}/samples/symmetric_matrix.cpp | 0 .../samples/triangular_adaptor.cpp | 0 doc/{ => ublas}/samples/triangular_matrix.cpp | 0 doc/{ => ublas}/samples/unbounded_array.cpp | 0 doc/{ => ublas}/samples/unit_vector.cpp | 0 doc/{ => ublas}/samples/vector.cpp | 0 doc/{ => ublas}/samples/vector_binary.cpp | 0 .../samples/vector_binary_outer.cpp | 0 .../samples/vector_binary_redux.cpp | 0 .../samples/vector_binary_scalar.cpp | 0 doc/{ => ublas}/samples/vector_range.cpp | 0 .../samples/vector_range_project.cpp | 0 doc/{ => ublas}/samples/vector_slice.cpp | 0 .../samples/vector_slice_project.cpp | 0 doc/{ => ublas}/samples/vector_unary.cpp | 0 .../samples/vector_unary_redux.cpp | 0 doc/{ => ublas}/samples/zero_matrix.cpp | 0 doc/{ => ublas}/samples/zero_vector.cpp | 0 doc/ublas/storage_concept.adoc | 109 ++ doc/ublas/storage_sparse.adoc | 210 +++ doc/ublas/symmetric.adoc | 401 +++++ doc/ublas/tensor.adoc | 351 ++++ doc/ublas/tensor/extents.adoc | 136 ++ doc/ublas/tensor/strides.adoc | 155 ++ doc/ublas/tensor/tensor_expression.adoc | 175 ++ doc/ublas/tensor/tensor_index.adoc | 53 + doc/ublas/triangular.adoc | 416 +++++ doc/ublas/types_overview.adoc | 352 ++++ doc/ublas/unbounded_array.adoc | 147 ++ doc/ublas/vector.adoc | 555 +++++++ doc/ublas/vector_expression.adoc | 913 +++++++++++ doc/ublas/vector_proxy.adoc | 443 +++++ doc/ublas/vector_sparse.adoc | 551 +++++++ doc/unbounded_array.html | 219 --- doc/vector.html | 755 --------- doc/vector_expression.html | 974 ----------- doc/vector_proxy.html | 527 ------ doc/vector_sparse.html | 800 --------- index.html | 28 +- 129 files changed, 13357 insertions(+), 19343 deletions(-) create mode 100644 doc/.gitignore create mode 100644 doc/Jamfile delete mode 100644 doc/banded.html delete mode 100644 doc/blas.html delete mode 100644 doc/bounded_array.html delete mode 100644 doc/container_concept.html delete mode 100644 doc/expression_concept.html delete mode 100644 doc/hermitian.html delete mode 100644 doc/index.html delete mode 100644 doc/iterator_concept.html delete mode 100644 doc/js/jquery-1.3.2.min.js delete mode 100644 doc/js/jquery.toc-gw.js delete mode 100644 doc/matrix.html delete mode 100644 doc/matrix_expression.html delete mode 100644 doc/matrix_proxy.html delete mode 100644 doc/matrix_sparse.html delete mode 100644 doc/operations_overview.html delete mode 100644 doc/options.html delete mode 100644 doc/overview.html delete mode 100644 doc/products.html delete mode 100644 doc/range.html delete mode 100644 doc/release_notes.html delete mode 100644 doc/storage_concept.html delete mode 100644 doc/storage_sparse.html delete mode 100644 doc/symmetric.html delete mode 100644 doc/tensor.html delete mode 100644 doc/tensor/extents.html delete mode 100644 doc/tensor/strides.html delete mode 100644 doc/tensor/tensor_expression.html delete mode 100644 doc/tensor/tensor_index.html delete mode 100644 doc/triangular.html delete mode 100644 doc/types_overview.html create mode 100644 doc/ublas-docinfo-footer.html create mode 100644 doc/ublas.adoc delete mode 100644 doc/ublas.css create mode 100644 doc/ublas/banded.adoc create mode 100644 doc/ublas/blas.adoc create mode 100644 doc/ublas/bounded_array.adoc create mode 100644 doc/ublas/container_concept.adoc create mode 100644 doc/ublas/expression_concept.adoc create mode 100644 doc/ublas/hermitian.adoc create mode 100644 doc/ublas/index.adoc create mode 100644 doc/ublas/iterator_concept.adoc create mode 100644 doc/ublas/matrix.adoc create mode 100644 doc/ublas/matrix_expression.adoc create mode 100644 doc/ublas/matrix_proxy.adoc create mode 100644 doc/ublas/matrix_sparse.adoc create mode 100644 doc/ublas/operations_overview.adoc create mode 100644 doc/ublas/options.adoc create mode 100644 doc/ublas/overview.adoc create mode 100644 doc/ublas/products.adoc create mode 100644 doc/ublas/range.adoc create mode 100644 doc/ublas/release_notes.adoc rename doc/{ => ublas}/samples/Jamfile.v2 (100%) rename doc/{ => ublas}/samples/assignment_examples.cpp (100%) rename doc/{ => ublas}/samples/banded_adaptor.cpp (100%) rename doc/{ => ublas}/samples/banded_matrix.cpp (100%) rename doc/{ => ublas}/samples/bounded_array.cpp (100%) rename doc/{ => ublas}/samples/compressed_matrix.cpp (100%) rename doc/{ => ublas}/samples/compressed_vector.cpp (100%) rename doc/{ => ublas}/samples/coordinate_matrix.cpp (100%) rename doc/{ => ublas}/samples/coordinate_vector.cpp (100%) rename doc/{ => ublas}/samples/ex_triangular.cpp (100%) rename doc/{ => ublas}/samples/hermitian_adaptor.cpp (100%) rename doc/{ => ublas}/samples/hermitian_matrix.cpp (100%) rename doc/{ => ublas}/samples/identity_matrix.cpp (100%) rename doc/{ => ublas}/samples/map_array.cpp (100%) rename doc/{ => ublas}/samples/mapped_matrix.cpp (100%) rename doc/{ => ublas}/samples/mapped_vector.cpp (100%) rename doc/{ => ublas}/samples/matrix.cpp (100%) rename doc/{ => ublas}/samples/matrix_binary.cpp (100%) rename doc/{ => ublas}/samples/matrix_binary_scalar.cpp (100%) rename doc/{ => ublas}/samples/matrix_column.cpp (100%) rename doc/{ => ublas}/samples/matrix_column_project.cpp (100%) rename doc/{ => ublas}/samples/matrix_matrix_binary.cpp (100%) rename doc/{ => ublas}/samples/matrix_matrix_solve.cpp (100%) rename doc/{ => ublas}/samples/matrix_range.cpp (100%) rename doc/{ => ublas}/samples/matrix_range_project.cpp (100%) rename doc/{ => ublas}/samples/matrix_row.cpp (100%) rename doc/{ => ublas}/samples/matrix_row_project.cpp (100%) rename doc/{ => ublas}/samples/matrix_slice.cpp (100%) rename doc/{ => ublas}/samples/matrix_slice_project.cpp (100%) rename doc/{ => ublas}/samples/matrix_unary.cpp (100%) rename doc/{ => ublas}/samples/matrix_vector_binary.cpp (100%) rename doc/{ => ublas}/samples/matrix_vector_range.cpp (100%) rename doc/{ => ublas}/samples/matrix_vector_slice.cpp (100%) rename doc/{ => ublas}/samples/matrix_vector_solve.cpp (100%) rename doc/{ => ublas}/samples/range.cpp (100%) rename doc/{ => ublas}/samples/slice.cpp (100%) rename doc/{ => ublas}/samples/symmetric_adaptor.cpp (100%) rename doc/{ => ublas}/samples/symmetric_matrix.cpp (100%) rename doc/{ => ublas}/samples/triangular_adaptor.cpp (100%) rename doc/{ => ublas}/samples/triangular_matrix.cpp (100%) rename doc/{ => ublas}/samples/unbounded_array.cpp (100%) rename doc/{ => ublas}/samples/unit_vector.cpp (100%) rename doc/{ => ublas}/samples/vector.cpp (100%) rename doc/{ => ublas}/samples/vector_binary.cpp (100%) rename doc/{ => ublas}/samples/vector_binary_outer.cpp (100%) rename doc/{ => ublas}/samples/vector_binary_redux.cpp (100%) rename doc/{ => ublas}/samples/vector_binary_scalar.cpp (100%) rename doc/{ => ublas}/samples/vector_range.cpp (100%) rename doc/{ => ublas}/samples/vector_range_project.cpp (100%) rename doc/{ => ublas}/samples/vector_slice.cpp (100%) rename doc/{ => ublas}/samples/vector_slice_project.cpp (100%) rename doc/{ => ublas}/samples/vector_unary.cpp (100%) rename doc/{ => ublas}/samples/vector_unary_redux.cpp (100%) rename doc/{ => ublas}/samples/zero_matrix.cpp (100%) rename doc/{ => ublas}/samples/zero_vector.cpp (100%) create mode 100644 doc/ublas/storage_concept.adoc create mode 100644 doc/ublas/storage_sparse.adoc create mode 100644 doc/ublas/symmetric.adoc create mode 100644 doc/ublas/tensor.adoc create mode 100644 doc/ublas/tensor/extents.adoc create mode 100644 doc/ublas/tensor/strides.adoc create mode 100644 doc/ublas/tensor/tensor_expression.adoc create mode 100644 doc/ublas/tensor/tensor_index.adoc create mode 100644 doc/ublas/triangular.adoc create mode 100644 doc/ublas/types_overview.adoc create mode 100644 doc/ublas/unbounded_array.adoc create mode 100644 doc/ublas/vector.adoc create mode 100644 doc/ublas/vector_expression.adoc create mode 100644 doc/ublas/vector_proxy.adoc create mode 100644 doc/ublas/vector_sparse.adoc delete mode 100644 doc/unbounded_array.html delete mode 100644 doc/vector.html delete mode 100644 doc/vector_expression.html delete mode 100644 doc/vector_proxy.html delete mode 100644 doc/vector_sparse.html diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 000000000..ed5fc760e --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1,2 @@ +/html/ +/pdf/ \ No newline at end of file diff --git a/doc/Jamfile b/doc/Jamfile new file mode 100644 index 000000000..63e8b036a --- /dev/null +++ b/doc/Jamfile @@ -0,0 +1,30 @@ +# Copyright 2021 Shikhar Vashistha +# +# Distributed under the Boost Software License, Version 1.0. +# (http://www.boost.org/LICENSE_1_0.txt) +# Copyright 2021 Shikhar Vashistha +# +# Distributed under the Boost Software License, Version 1.0. +# (http://www.boost.org/LICENSE_1_0.txt) + +import asciidoctor ; + +html ublas.html : ublas.adoc ; + +install html_ : ublas.html : html ; + +pdf ublas.pdf : ublas.adoc ; + +explicit ublas.pdf ; + +install pdf_ : ublas.pdf : pdf ; + +explicit pdf_ ; + +alias boostdoc ; + +explicit boostdoc ; + +alias boostrelease : html_ ; + +explicit boostrelease ; \ No newline at end of file diff --git a/doc/banded.html b/doc/banded.html deleted file mode 100644 index 6ce82f2df..000000000 --- a/doc/banded.html +++ /dev/null @@ -1,580 +0,0 @@ - - - - - - - - - -Banded Matrix - - -

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

- - - - - - - - - - - - - - - - - - - - - - - -
ParameterDescriptionDefault
TThe type of object stored in the matrix.
FFunctor describing the storage organization. [1]row_major
AThe type of the adapted array. [2]unbounded_array<T>
-

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MemberDescription
banded_matrix ()Allocates an uninitialized banded_matrix that -holds zero rows of zero elements.
banded_matrix (size_type size1, size_type size2, -size_type lower = 0, size_type upper = 0)Allocates an uninitialized banded_matrix that -holds (lower + 1 + upper) diagonals around the main -diagonal of a matrix with size1 rows of -size2 elements.
banded_matrix (const banded_matrix &m)The copy constructor.
template<class AE>
-banded_matrix (const matrix_expression<AE> -&ae)
The extended copy constructor.
void resize (size_type size1, size_type size2, size_type -lower = 0, size_type upper = 0, bool preserve = true)Reallocates a banded_matrix to hold (lower + -1 + upper) diagonals around the main diagonal of a matrix -with size1 rows of size2 elements. The -existing elements of the banded_matrix are preseved -when specified.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
size_type lower () constReturns the number of diagonals below the main diagonal.
size_type upper () constReturns the number of diagonals above the main diagonal.
const_reference operator () (size_type i, size_type j) -constReturns 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.
banded_matrix &operator = (const banded_matrix -&m)The assignment operator.
banded_matrix &assign_temporary (banded_matrix -&m)Assigns a temporary. May change the banded matrix -m .
template<class AE>
-banded_matrix &operator = (const matrix_expression<AE> -&ae)
The extended assignment operator.
template<class AE>
-banded_matrix &assign (const matrix_expression<AE> -&ae)
Assigns a matrix expression to the banded matrix. Left and -right hand side of the assignment should be independent.
template<class AE>
-banded_matrix &operator += (const matrix_expression<AE> -&ae)
A computed assignment operator. Adds the matrix expression to -the banded matrix.
template<class AE>
-banded_matrix &plus_assign (const matrix_expression<AE> -&ae)
Adds a matrix expression to the banded matrix. Left and right -hand side of the assignment should be independent.
template<class AE>
-banded_matrix &operator -= (const matrix_expression<AE> -&ae)
A computed assignment operator. Subtracts the matrix expression -from the banded matrix.
template<class AE>
-banded_matrix &minus_assign (const matrix_expression<AE> -&ae)
Subtracts a matrix expression from the banded matrix. Left and -right hand side of the assignment should be independent.
template<class AT>
-banded_matrix &operator *= (const AT &at)
A computed assignment operator. Multiplies the banded matrix -with a scalar.
template<class AT>
-banded_matrix &operator /= (const AT &at)
A computed assignment operator. Divides the banded matrix -through a scalar.
void swap (banded_matrix &m)Swaps the contents of the banded 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 () constReturns a const_iterator1 pointing to the -beginning of the banded_matrix.
const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the banded_matrix.
iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the banded_matrix.
iterator1 end1 ()Returns a iterator1 pointing to the end of the -banded_matrix.
const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the banded_matrix.
const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the banded_matrix.
iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the banded_matrix.
iterator2 end2 ()Returns a iterator2 pointing to the end of the -banded_matrix.
const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed banded_matrix.
const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed banded_matrix.
reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed banded_matrix.
reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed banded_matrix.
const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed banded_matrix.
const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed banded_matrix.
reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed banded_matrix.
reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed banded_matrix.
-

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

- - - - - - - - - - - - - -
ParameterDescriptionDefault
MThe type of the adapted matrix.
-

Model of

-

Matrix Expression -.

-

Type requirements

-

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

-

Public base classes

-

matrix_expression<banded_adaptor<M> ->

-

Members

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MemberDescription
banded_adaptor (matrix_type &data, size_type lower = -0, size_type upper = 0)Constructs a banded_adaptor that holds -(lower + 1 + upper) diagonals around the main diagonal -of a matrix.
banded_adaptor (const banded_adaptor &m)The copy constructor.
template<class AE>
-banded_adaptor (const matrix_expression<AE> -&ae)
The extended copy constructor.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
size_type lower () constReturns the number of diagonals below the main diagonal.
size_type upper () constReturns the number of diagonals above the main diagonal.
const_reference operator () (size_type i, size_type j) -constReturns 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.
banded_adaptor &operator = (const banded_adaptor -&m)The assignment operator.
banded_adaptor &assign_temporary (banded_adaptor -&m)Assigns a temporary. May change the banded adaptor -m .
template<class AE>
-banded_adaptor &operator = (const matrix_expression<AE> -&ae)
The extended assignment operator.
template<class AE>
-banded_adaptor &assign (const matrix_expression<AE> -&ae)
Assigns a matrix expression to the banded adaptor. Left and -right hand side of the assignment should be independent.
template<class AE>
-banded_adaptor &operator += (const matrix_expression<AE> -&ae)
A computed assignment operator. Adds the matrix expression to -the banded adaptor.
template<class AE>
-banded_adaptor &plus_assign (const matrix_expression<AE> -&ae)
Adds a matrix expression to the banded adaptor. Left and right -hand side of the assignment should be independent.
template<class AE>
-banded_adaptor &operator -= (const matrix_expression<AE> -&ae)
A computed assignment operator. Subtracts the matrix expression -from the banded adaptor.
template<class AE>
-banded_adaptor &minus_assign (const matrix_expression<AE> -&ae)
Subtracts a matrix expression from the banded adaptor. Left and -right hand side of the assignment should be independent.
template<class AT>
-banded_adaptor &operator *= (const AT &at)
A computed assignment operator. Multiplies the banded adaptor -with a scalar.
template<class AT>
-banded_adaptor &operator /= (const AT &at)
A computed assignment operator. Divides the banded adaptor -through a scalar.
void swap (banded_adaptor &m)Swaps the contents of the banded adaptors.
const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the banded_adaptor.
const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the banded_adaptor.
iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the banded_adaptor.
iterator1 end1 ()Returns a iterator1 pointing to the end of the -banded_adaptor.
const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the banded_adaptor.
const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the banded_adaptor.
iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the banded_adaptor.
iterator2 end2 ()Returns a iterator2 pointing to the end of the -banded_adaptor.
const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed banded_adaptor.
const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed banded_adaptor.
reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed banded_adaptor.
reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed banded_adaptor.
const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed banded_adaptor.
const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed banded_adaptor.
reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed banded_adaptor.
reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed banded_adaptor.
-
-

Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
- 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). -

- - - diff --git a/doc/blas.html b/doc/blas.html deleted file mode 100644 index 07573e835..000000000 --- a/doc/blas.html +++ /dev/null @@ -1,452 +0,0 @@ - - - - - BLAS - - - - - - - - - - - -

Level 3 BLAS

-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Functions

template<class M1, class T, class M2, class M3> M1 & boost::numeric::ublas::blas_3::tmm (M1 &m1, const T &t, const M2 &m2, const M3 &m3)
 triangular matrix multiplication

template<class M1, class T, class M2, class C> M1 & boost::numeric::ublas::blas_3::tsm (M1 &m1, const T &t, const M2 &m2, C)
 triangular solve m2 * x = t * m1 in place, m2 is a triangular matrix

template<class M1, class T1, class T2, class M2, class M3> M1 & boost::numeric::ublas::blas_3::gmm (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)
 general matrix multiplication

template<class M1, class T1, class T2, class M2> M1 & boost::numeric::ublas::blas_3::srk (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2)
 symmetric rank k update: m1 = t * m1 + t2 * (m2 * m2T)

template<class M1, class T1, class T2, class M2> M1 & boost::numeric::ublas::blas_3::hrk (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2)
 hermitian rank k update: m1 = t * m1 + t2 * (m2 * m2H)

template<class M1, class T1, class T2, class M2, class M3> M1 & boost::numeric::ublas::blas_3::sr2k (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)
 generalized symmetric rank k update: m1 = t1 * m1 + t2 * (m2 * m3T) + t2 * (m3 * m2T)

template<class M1, class T1, class T2, class M2, class M3> M1 & boost::numeric::ublas::blas_3::hr2k (M1 &m1, const T1 &t1, const T2 &t2, const M2 &m2, const M3 &m3)
 generalized hermitian rank k update: m1 = t1 * m1 + t2 * (m2 * m3H) + (m3 * (t2 * m2)H)

template<class M, class E1, class E2> BOOST_UBLAS_INLINE M & boost::numeric::ublas::axpy_prod (const matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, bool init=true)
 computes M += A X or M = A X in an optimized fashion.

template<class M, class E1, class E2> BOOST_UBLAS_INLINE M & boost::numeric::ublas::opb_prod (const matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, bool init=true)
 computes M += A X or M = A X in an optimized fashion.

- -
- -

Function Documentation

- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M1& tmm M1 &  m1,
const T &  t,
const M2 &  m2,
const M3 &  m3
-
- - - - - -
-   - -

triangular matrix multiplication

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M1& tsm M1 &  m1,
const T &  t,
const M2 &  m2,
-
- - - - - -
-   - - -

-triangular solve m2 * x = t * m1 in place, m2 is a triangular matrix -

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M1& gmm M1 &  m1,
const T1 &  t1,
const T2 &  t2,
const M2 &  m2,
const M3 &  m3
-
- - - - - -
-   - - -

-general matrix multiplication -

-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M1& srk M1 &  m1,
const T1 &  t1,
const T2 &  t2,
const M2 &  m2
-
- - - - - -
-   - - -

-symmetric rank k update: m1 = t * m1 + t2 * (m2 * m2T) -

-
Todo:
use opb_prod()
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M1& hrk M1 &  m1,
const T1 &  t1,
const T2 &  t2,
const M2 &  m2
-
- - - - - -
-   - - -

-hermitian rank k update: m1 = t * m1 + t2 * (m2 * m2H) -

-
Todo:
use opb_prod()
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M1& sr2k M1 &  m1,
const T1 &  t1,
const T2 &  t2,
const M2 &  m2,
const M3 &  m3
-
- - - - - -
-   - - -

-generalized symmetric rank k update: m1 = t1 * m1 + t2 * (m2 * m3T) + t2 * (m3 * m2T) -

-
Todo:
use opb_prod()
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M1& hr2k M1 &  m1,
const T1 &  t1,
const T2 &  t2,
const M2 &  m2,
const M3 &  m3
-
- - - - - -
-   - - -

-generalized hermitian rank k update: m1 = t1 * m1 + t2 * (m2 * m3H) + (m3 * (t2 * m2)H) -

-
Todo:
use opb_prod()
-
- - - -
-

Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, -Joerg Walter, Gunter Winkler
-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). -

- - - diff --git a/doc/bounded_array.html b/doc/bounded_array.html deleted file mode 100644 index fea0d7b53..000000000 --- a/doc/bounded_array.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - -Bounded Array; - - -

Bounded Array Storage

-
-

Bounded Array

-

Description

-

The templated class bounded_array<T, N, ALLOC> implements a bounded storage array. The bounded array is similar to a C++ array type in that its maximum size is bounded by N and is allocated on the stack instead of the heap. Similarly a bounded_array requires no secondary storage and ALLOC is only used to specify size_type and difference_type. -

-

When resized bounded_array never reallocated the storage. It is therefore always efficient to resize a bounded_array but the size bound N must not be exceeded.

-

Example

-
-#include <boost/numeric/ublas/storage.hpp>
-
-int main () {
-    using namespace boost::numeric::ublas;
-    bounded_array<double, 3> a (3);
-    for (unsigned i = 0; i < a.size (); ++ i) {
-        a [i] = i;
-        std::cout << a [i] << std::endl;
-    }
-}
-
-

Definition

-

Defined in the header storage.hpp.

-

Template parameters

- - - - - - - - - - - - - - - - - - - - - - - -
ParameterDescriptionDefault
TThe type of object stored in the array.
NThe allocation size of the array.
ALLOCAn STL Allocatorstd::allocator
-

Model of

-

Storage

-

Type requirements

-

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

-

Public base classes

-

None.

-

Members

-
    -
  • The description does not describe what the member actually does, this can be looked up -in the corresponding concept documentation, but instead contains a remark on the implementation of the -member inside this model of the concept.
  • -
  • Typography: -
      -
    • Members that are not part of the implemented concepts are in blue.
    • -
    -
  • -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MemberWhere definedDescription
value_typeContainer
pointerContainerDefined as value_type*
const_pointerContainerDefined as const value_type*
referenceContainerDefined as value_type&
const_referenceContainerDefined as const value_type&
size_typeContainerDefined as Alloc::size_type
difference_typeContainerDefined as Alloc::difference_type
iteratorContainerDefined as pointer
const_iteratorContainerDefined as const_pointer
revere_iteratorContainerDefined as std::reverse_iterator<iterator>
const_revere_iteratorContainerDefined as std::reverse_iterator<const_iterator>
bounded_array ()StorageCreates an unbounded_array that holds zero elements.
bounded_array (size_type size)StorageCreates a uninitialized bounded_array that holds size elements. All the elements are default constructed.
bounded_array (size_type size, const T& init)StorageCreates an initialized bounded_array that holds size elements. All the elements are constructed from the init value.
bounded_array (const bounded_array &c)ContainerThe copy constructor.
~bounded_array ()ContainerDeallocates the bounded_array itself.
void resize (size_type size)Storage -Reallocates a bounded_array to hold size elements.
void resize (size_type size, const T& t)Storage -Reallocates a bounded_array to hold size elements.
size_type size () constContainerReturns the size of the bounded_array.
const_reference operator [] (size_type i) constContainerReturns a const reference of the i -th element.
reference operator [] (size_type i)ContainerReturns a reference of the i-th element.
bounded_array &operator = (const bounded_array &a)ContainerThe assignment operator.
bounded_array &assign_temporary (bounded_array &a)Assigns a temporary. May change the array a.
void swap (bounded_array &a)ContainerSwaps the contents of the arrays.
const_iterator begin () constContainerReturns a const_iterator pointing to the beginning of the bounded_array.
const_iterator end () constContainerReturns a const_iterator pointing to the end of the bounded_array.
iterator begin ()ContainerReturns a iterator pointing to the beginning of the bounded_array.
iterator end ()ContainerReturns a iterator pointing to the end of the bounded_array.
const_reverse_iterator rbegin () constReversible ContainerReturns a const_reverse_iterator pointing to the beginning of the reversed bounded_array.
const_reverse_iterator rend () constReversible ContainerReturns a const_reverse_iterator pointing to the end of the reversed bounded_array.
reverse_iterator rbegin ()Reversible ContainerReturns a reverse_iterator pointing to the beginning of the reversed bounded_array.
reverse_iterator rend ()Reversible ContainerReturns a reverse_iterator pointing to the end of the reversed bounded_array.
-
-

- Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, - Joerg Walter, Gunter Winkler
- 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 - ). -

- - - diff --git a/doc/container_concept.html b/doc/container_concept.html deleted file mode 100644 index 7027e83ec..000000000 --- a/doc/container_concept.html +++ /dev/null @@ -1,629 +0,0 @@ - - - - - - - - - - - - -Container Concepts - - -

Container Concepts

-
-

Vector

-

Description

-

A Vector describes common aspects of dense, packed and sparse -vectors.

-

Refinement of

-

DefaultConstructible, -Vector Expression -[1].

-

Associated types

-

In addition to the types defined by Vector Expression

- - - - - - - - - - - - - -
Public basevector_container<V>V must be derived from this public base type.
Storage arrayV::array_type -Dense Vector ONLY. The type of underlying storage array used to store the elements. The array_type must model the -Storage concept.
-

Notation

- - - - - - - - - - - - - - - - - - - - - - - -
VA type that is a model of Vector
vObjects of type V
n, iObjects of a type convertible to size_type
tObject of a type convertible to value_type
pObject of a type convertible to bool
-

Definitions

-

Valid expressions

-

In addition to the expressions defined in DefaultConstructible, -Vector Expression the following expressions must be valid.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Sizing constructorV v (n) V
Insertv.insert_element (i, t)v is mutable.void
Erasev.erase_element (i)v is mutable.void
Clearv.clear ()v is mutable.void
Resizev.resize (n)
-v.resize (n, p)
v is mutable.void
Storagev.data()v is mutable and Dense.array_type& if v is mutable, const array_type& otherwise
-

Expression semantics

-

Semantics of an expression is defined only where it differs -from, or is not defined in Vector Expression .

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionPreconditionSemanticsPostcondition
Sizing constructorV v (n)n >= 0Allocates a vector ofn elements.v.size () == n.
Element access [2]v[n]0<n>v.size()returns the n-th element in v 
Insertv.insert_element (i, t)0 <= i < v.size ().Inserts an element at v (i) with value t. -The storage requirement of the Vector may be increased.v (i) is equal to t.
Erasev.erase_element (i)0 <= i < v.size ()Destroys the element as v (i) and replaces it with the default -value_type (). -The storage requirement of the Vector may be decreased.v (i) is equal to value_type ().
Clearv.clear () Equivalent to
-for (i = 0; i < v.size (); ++ i)
v.erase_element (i);
 
Resizev.resize (n) -
v.resize (n, p)
 Reallocates the vector so that it can hold n -elements.
-Erases or appends elements in order to bring the vector to the prescribed size. Appended elements copies of value_type(). -
-When p == false then existing elements are not preserved and elements will not appended as normal. Instead the vector is in the same state as that after an equivalent sizing constructor.
v.size () == n.
Storagev.data()Returns a reference to the underlying dense storage. 
-

Complexity guarantees

-

The run-time complexity of the sizing constructor is linear in -the vector's size.

-

The run-time complexity of insert_element and erase_element is specific for the -Vector model and it depends on increases/decreases in storage requirements.

-

The run-time complexity of resize is linear in the vector's -size.

-

Invariants

-

Models

-
    -
  • vector, bounded_vector, c_vector
  • -
  • unit_vector, zero_vector, scalar_vector
  • -
  • mapped_vector;, compressed_vector, coordinate_vector
  • -
-

Notes

-

[1] -As a user you need not care about Vector being a refinement of the VectorExpression. Being a refinement of the VectorExpression is only important for the template-expression engine but not the user.

-

[2] -The operator[] is added purely for convenience -and compatibility with the std::vector. In uBLAS however, -generally operator() is used for indexing because this can be -used for both vectors and matrices.

- - -
- - - -

Matrix

-

Description

-

A Matrix describes common aspects of dense, packed and sparse -matrices.

-

Refinement of

-

DefaultConstructible, -Matrix Expression -[1] -.

-

Associated types

-

In addition to the types defined by Matrix Expression

- - - - - - - - - - - - - -
Public basematrix_container<M>M must be derived from this public base type.
Storage arrayM::array_typeDense Matrix ONLY. The type of underlying storage array used to store the elements. The array_type must model -the Storage concept.
-

Notation

- - - - - - - - - - - - - - - - - - - - - - - -
MA type that is a model of Matrix
mObjects of type M
n1, n2, i, jObjects of a type convertible to size_type
tObject of a type convertible to value_type
pObject of a type convertible to bool
-

Definitions

-

Valid expressions

-

In addition to the expressions defined in Matrix Expression the -following expressions must be valid.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Sizing constructorM m (n1, n2) M
Insertm.insert_element (i, j, t)m is mutable.void
Erasem.erase_element (i, j)m is mutable.void
Clearm.clear ()m is mutable.void
Resizem.resize (n1, n2)
-m.resize (n1, n2, p)
m is mutable.void
Storagem.data()m is mutable and Dense.array_type& if m is mutable, const array_type& otherwise
-

Expression semantics

-

Semantics of an expression is defined only where it differs -from, or is not defined in Matrix Expression .

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionPreconditionSemanticsPostcondition
Sizing constructorM m (n1, n2)n1 >= 0 and n2 >= 0Allocates a matrix of n1 rows and n2 -columns.m.size1 () == n1 and m.size2 () == -n2.
Insertm.insert_element (i, j, t)0 <= i < m.size1 (),
-0 <= j < m.size2 ().
Inserts an element at m (i, j) with value t. -The storage requirement of the Matrix may be increased.m (i, j) is equal to t.
Erasem.erase_element (i, j)0 <= i < m.size1 ()and
-0 <= j < m.size2
Destroys the element as m (i, j) and replaces it with the default -value_type (). -The storage requirement of the Matrix may be decreased.m (i, j) is equal to value_type ().
Clearm.clear () Equivalent to
-for (i = 0; i < m.size1 (); ++ i)
for (j = 0; j < m.size2 (); ++ j)
-    m.erase_element (i, j);
 
Resizem.resize (n1, n2) -
-m.resize (n1, n2, p) -
 Reallocate the matrix so that it can hold n1 rows -and n2 columns.
-Erases or appends elements in order to bring the matrix to the -prescribed size. Appended elements are value_type() -copies.
-When p == false then existing elements are not preserved and elements will not appended as normal. Instead the matrix is in the same state as that after an equivalent sizing constructor.
m.size1 () == n1 and m.size2 () == n2.
Storagem.data()Returns a reference to the underlying dense storage. 
-

Complexity guarantees

-

The run-time complexity of the sizing constructor is quadratic -in the matrix's size.

-

The run-time complexity of insert_element and erase_element is specific for the -Matrix model and it depends on increases/decreases in storage requirements.

-

The run-time complexity of resize is quadratic in the matrix's -size.

-

Invariants

-

Models

-
    -
  • matrix, bounded_matrix, c_matrix
  • -
  • identity_matrix , zero_matrix , scalar_matrix
  • -
  • triangular_matrix , symmetric_matrix , banded_matrix
  • -
  • mapped_matrix , compressed_matrix , coordinate_matrix
  • -
-

Notes

-

[1] -As a user you need not care about Matrix being a refinement of the MatrixExpression. Being a refinement of the MatrixExpression is only important for the template-expression engine but not the user.

- -
- - - -

Tensor

-

Description

-

A Tensor describes common aspects of dense multidimensional arrays.

-

Refinement of

-

DefaultConstructible, -Tensor Expression -[1] -.

-

Associated types

-

In addition to the types defined by Tensor Expression

- - - - - - - - - - - - - -
Public basetensor_container<tensor_t>tensor_t must be derived from this public base type.
Storage arraytensor_t::array_typeDense tensor ONLY. The type of underlying storage array used to store the elements. The array_type must model -the Storage concept.
-

Notation

- - - - - - - - - - - - - - - - - - - - - - - -
tensor_tA type that is a model of Tensor
tObjects of type tensor_t
n1, n2, np, m1, m2, mq Dimension objects of a type convertible to size_type
i1, i2, ip, j, k Index objects of a type convertible to size_type
vObject of a type convertible to value_type
-

Definitions

-

Valid expressions

-

In addition to the expressions defined in Tensor Expression the -following expressions must be valid.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Sizing constructorT t(n1, n2, ..., np) T
Writet.at(i1, i2, ..., ip)t is mutable.void
Readt.at(i1, i2, ..., ip)t is mutable.v
Cleart.clear ()t is mutable.void
Resizet.resize(m1, m2, ... , mq)t is mutable.void
Storaget.data()t is mutable and dense.pointer if t is mutable, const_pointer otherwise
-

Expression semantics

-

Semantics of an expression is defined only where it differs -from, or is not defined in Tensor Expression .

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionPreconditionSemanticsPostcondition
Sizing constructorT t(n1, n2, ..., np)$n_r \geq 1$ for $1\leq 1 \leq p $Allocates a p-order tensor with dimension extents $n_1,n_2,\dots,n_p$.t.size(r)==nr for $1\leq r \leq p$.
Writet.at(i1,i2,...,ip)=v$0 \leq i_r < n_r$ for $1 \leq r \leq p$.Writes an element at multi-index position $i_1,i_2,\dots,i_p$ with value v.t(i1,i2,...,ip) is equal to v.
Readv=t.at(i1,i2,...,ip)$0 \leq i_r < n_r$ for $1 \leq r \leq p$.Reads the element at multi-index position $(i_1,i2_,\dots,i_p)$ and returns a value v.t(i1,i2,...,ip) is equal to v.
Cleart.clear() Removes all elements from the container. 
Resizet.resize(m1, m2, ..., mq)$m_r \geq 1$ for $1\leq 1 \leq q $Reallocate the matrix so that it can hold $m_1\times m_2\times \cdots \times m_q$ elements.
-Erases or appends elements in order to bring the matrix to the -prescribed size. Appended elements are value_type() -copies.
t.size(r) == mr for $1\leq r \leq q$.
Storagem.data()Returns a reference to the underlying dense storage. 
-

Complexity guarantees

-

The run-time complexity of contructor is linear in the tensor's size $n_1 \times n_2 \times \cdots \times n_p$.

-

The run-time complexity of write() and read() is linear in the order of the tensor.

-

The run-time complexity of resize is at most linear in the tensor's size $m_1 \times m_2 \times \cdots \times n_q$.

-

Invariants

-

Models

-
    -
  • tensor
  • -
- -

Notes

-

[1] -As a user you need not care about Tensor being a refinement of the TensorExpression. Being a refinement of the TensorExpression is only important for the template-expression engine but not the user.

- - - - -
-

-Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
-Copyright (©) 2018 Cem Bassoy
- 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 - ). -

- - - diff --git a/doc/expression_concept.html b/doc/expression_concept.html deleted file mode 100644 index ffbfd1481..000000000 --- a/doc/expression_concept.html +++ /dev/null @@ -1,1074 +0,0 @@ - - - - - - - - -Expression Concepts - - -

Expression Concepts

-
-

Scalar Expression

-

Description

-

A Scalar Expression is an expression convertible to a scalar -type.

-

Refinement of

-

Default Constructible.

-

Associated types

- - - - - - - - - - - - - -
Public basescaler_expression<S>S must be derived from this public base type.
Value typevalue_typeThe type of the scalar expression.
-

Notation

- - - - - - - -
SA type that is a model of Scalar Expression
-

Definitions

-

Valid expressions

-

In addition to the expressions defined in Default Constructible -the following expressions must be valid.

- - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Evaluationoperator value_type () const value_type
-

Expression semantics

-

Semantics of an expression is defined only where it differs -from, or is not defined in Default Constructible.

- - - - - - - - - - - - - - - - - -
NameExpressionPreconditionSemanticsPostcondition
Evaluationoperator value_type () const   Evaluates the scalar expression. 
-

Complexity guarantees

-

The run-time complexity of the evaluation is specific for the -evaluated scalar expression.

-

Invariants

-

Models

-
    -
  • vector_scalar_unary
  • -
  • vector_scalar_binary
  • -
-

Vector Expression

-

Description

-

A Vector Expression is an expression evaluatable to a vector. -Vector Expression provides an Indexed Bidirectional -Iterator or an Indexed Random Access -Iterator .

-

Refinement of

-

Default Constructible.

-

Associated types

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Public basevector_expression<V>V must be derived from this public base type.
Value typevalue_type -The element type of the vector expression. -
Reference typereference -The return type when accessing an element of a vector expression. -
-Convertable to avalue_type. -
Const reference typeconst_reference -The return type when accessing an element of a constant vector expression. -
-Convertable to avalue_type. -
Size typesize_type -The index type of the vector expression. Am unsigned integral type used to represent size and index values. -
-Can represent any nonnegative value of difference_type. -
Distance typedifference_type -A signed integral type used to represent the distance between two of the vector expression's iterators. -
Const iterator typeconst_iteratorA type of iterator that may be used to examine a vector -expression's elements.
Iterator typeiteratorA type of iterator that may be used to modify a vector -expression's elements.
Const reverse iterator typeconst_reverse_iteratorA Reverse Iterator adaptor whose base iterator type is the -vector expression's const iterator type.
Reverse iterator typereverse_iteratorA Reverse Iterator adaptor whose base iterator type is the -vector expression's iterator type.
-

Notation

- - - - - - - - - - - - - - - - - - - -
VA type that is a model of Vector Expression
v, v1, v2Object of type V
iObject of a type convertible to size_type
tObject of a type convertible to value_type
-

Definitions

-

Valid expressions

-

In addition to the expressions defined in Default Constructible -the following expressions must be valid.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Beginning of rangev.begin () const_iterator
v.begin ()v is mutable.iterator
End of rangev.end () const_iterator
v.end ()v is mutable.iterator
Sizev.size () size_type
Swapv1.swap (v2)v1 and v2 are mutable.void
Beginning of reverse rangev.rbegin () const_reverse_iterator
v.rbegin ()v is mutable.reverse_iterator
End of reverse rangev.rend () const_reverse_iterator
v.rend ()v is mutable.reverse_iterator
Element accessv (i)i is convertible to size_type.Convertible to value_type.
Assignmentv2 = v1v2 is mutable and v1 is convertible -to V.V &
v2.assign (v1)v2 is mutable and v1 is convertible -to V.V &
Computed assignmentv2 += v1v2 is mutable and v1 is convertible -to V.V &
v2.plus_assign (v1)v2 is mutable and v1 is convertible -to V.V &
v2 -= v1v2 is mutable and v1 is convertible -to V.V &
v2.minus_assign (v1)v2 is mutable and v1 is convertible -to V.V &
v *= tv is mutable and t is convertible to -value_type.V &
-

Expression semantics

-

Semantics of an expression is defined only where it differs -from, or is not defined in Default Constructible.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionPreconditionSemanticsPostcondition
Beginning of rangev.begin () Returns an iterator pointing to the first element in the vector -expression.v.begin () is either dereferenceable or -past-the-end. It is past-the-end if and only if v.size () == -0.
End of rangev.end () Returns an iterator pointing one past the last element in the -vector expression.v.end () is past-the-end.
Sizev.size () Returns the size of the vector expression, that is, its number -of elements.v.size () >= 0
Swapv1.swap (v2) Equivalent to swap (v1, v2). 
Beginning of reverse rangev.rbegin () Equivalent to reverse_iterator (v.end ()).v.rbegin () is either dereferenceable or -past-the-end. It is past-the-end if and only if v.size () == -0.
End of reverse rangev.rend () Equivalent to reverse_iterator (v.begin ()).v.rend () is past-the-end.
Element accessv (i)0 <= i < v.size ()Returns the i-th element of the vector -expression. 
Assignmentv2 = v1v1.size () == v2.size ()Assigns every element of the evaluated vector expression -v1 to the corresponding element of v2 -. 
v2.assign (v1)v1.size () == v2.size ()Assigns every element of v1 to the corresponding -element of v2. 
Computed assignmentv2 += v1v1.size () == v2.size ()Adds every element of the evaluated vector expression -v1 to the corresponding element of -v2. 
v2.plus_assign (v1)v1.size () == v2.size ()Adds every element of v1 to the corresponding -element of v2. 
v2 -= v1v1.size () == v2.size ()Subtracts every element of the evaluated vector expression -v1 from the corresponding element of v2 -. 
v2.minus_assign (v1)v1.size () == v2.size ()Subtracts every element of v1 from the -corresponding element of v2. 
v *= t Multiplies every element of v with t -. 
-

Complexity guarantees

-

The run-time complexity of begin () and end -() is specific for the evaluated vector expression, -typically amortized constant time.

-

The run-time complexity of size () is constant -time.

-

The run-time complexity of swap () is specific for -the evaluated vector expression, typically constant time.

-

The run-time complexity of rbegin () and rend -() is specific for the evaluated vector expression, -typically amortized constant time.

-

The run-time complexity of the element access is specific for -the evaluated vector expression, typically amortized constant time -for the dense and logarithmic for the sparse case.

-

The run-time complexity of the arithmetic operations is specific -for the evaluated vector expressions, typically linear in the size -of the expressions.

-

Invariants

- - - - - - - - - - - - - - - - - - - -
Valid rangeFor any vector expression v, [v.begin (), -v.end ()) is a valid range.
CompletenessAn algorithm that iterates through the range [v.begin (), -v.end ()) will pass through every element of v -.
Valid reverse range[v.rbegin (), v.rend ()) is a valid range.
Equivalence of rangesThe distance from v.begin () to v.end -() is the same as the distance from v.rbegin () -to v.rend ().
-

Models

-
    -
  • vector_range;
  • -
  • vector_slice
  • -
  • matrix_row
  • -
  • matrix_column
  • -
  • matrix_vector_range
  • -
  • matrix_vector_slice
  • -
  • vector_unary
  • -
  • vector_binary
  • -
  • vector_binary_scalar1
  • -
  • vector_binary_scalar2
  • -
  • matrix_vector_unary1
  • -
  • matrix_vector_unary2
  • -
  • matrix_vector_binary1
  • -
  • matrix_vector_binary2
  • -
- -

Matrix Expression

-

Description

-

A Matrix Expression is an expression evaluatable to a matrix. -Matrix Expression provides an Indexed -Bidirectional Column/Row Iterator or an Indexed Random -Access Column/Row Iterator .

-

Refinement of

-

Default Constructible.

- -

Associated types

-
immutable types
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Public basematrix_expression<M>M must be derived from this public base type.
Value typevalue_type -The element type of the matrix expression. -
Const reference typeconst_reference -The return type when accessing an element of a constant matrix expression. -
-Convertable to a value_type. -
Size typesize_type -The index type of the matrix expression. Am unsigned integral type used to represent size and index values. -
-Can represent any nonnegative value of difference_type. -
Distance typedifference_type -A signed integral type used to represent the distance between two of the matrix expression's iterators. -
Const iterator typesconst_iterator1A type of column iterator that may be used to examine a matrix -expression's elements.
const_iterator2A type of row iterator that may be used to examine a matrix -expression's elements.
Const reverse iterator typesconst_reverse_iterator1A Reverse Iterator adaptor whose base iterator type is the -matrix expression's const column iterator type.
const_reverse_iterator2A Reverse Iterator adaptor whose base iterator type is the -matrix expression's const row iterator type.
- -
mutable types
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Reference typereference -The return type when accessing an element of a matrix expression. -
-Convertable to a value_type. -
Iterator typesiterator1A type of column iterator that may be used to modify a matrix -expression's elements.
iterator2A type of row iterator that may be used to modify a matrix -expression's elements.
Reverse iterator typesreverse_iterator1A Reverse Iterator adaptor whose base iterator type is the -matrix expression's column iterator type.
reverse_iterator2A Reverse Iterator adaptor whose base iterator type is the -matrix expression's row iterator type.
- - -

Notation

- - - - - - - - - - - - - - - - - - - -
MA type that is a model of Matrix Expression
m, m1, m2Object of type M
i, jObjects of a type convertible to size_type
tObject of a type convertible to value_type
-

Definitions

-

Valid expressions

-

In addition to the expressions defined in Default Constructible -the following expressions must be valid.

- -
immutable expressions
- - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Sizem.size1 () size_type
m.size2 () size_type
- -
possibly mutable expressions
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Beginning of rangem.begin1 () const_iterator1
m.begin2 () const_iterator2
m.begin1 ()m is mutable. iterator1
m.begin2 ()m is mutable.iterator2
End of rangem.end1 () const_iterator1
m.end2 () const_iterator2
m.end1 ()m is mutable. iterator1
m.end2 ()m is mutable.iterator2
Swapm1.swap (m2)m1 and m2 are mutable. void
Beginning of reverse rangem.rbegin1 () const_reverse_iterator1
m.rbegin2 () const_reverse_iterator2
m.rbegin1 ()m is mutable. reverse_iterator1
m.rbegin2 ()m is mutable.reverse_iterator2
End of reverse rangem.rend1 () const_reverse_iterator1
m.rend2 () const_reverse_iterator2
m.rend1 ()m is mutable.reverse_iterator1
m.rend2 ()m is mutable.reverse_iterator2
Element accessm (i, j)i and j are convertible to -size_type .Convertible to value_type.
Assignmentm2 = m1m2 is mutable and m1 is convertible -to M.M &
m2.assign (m1)m2 is mutable and m1 is convertible -to M.M &
Computed assignmentm2 += m1m2 is mutable and m1 is convertible -to M.M &
m2.plus_assign (m1)m2 is mutable and m1 is convertible -to M.M &
m2 -= m1m2 is mutable and m1 is convertible -to M.M &
m2.minus_assign (m1)m2 is mutable and m1 is convertible -to M.M &
m *= tm is mutable and t is convertible to -value_type.M &
-

Expression semantics

-

Semantics of an expression is defined only where it differs -from, or is not defined in Default Constructible.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionPreconditionSemanticsPostcondition
Beginning of rangem.begin1 () Returns an iterator pointing to the first element in the first -column of a matrix expression.m.begin1 () is either dereferenceable or -past-the-end. It is past-the-end if and only if m.size1 () == -0.
m.begin2 () Returns an iterator pointing to the first element in the first -row of a matrix expression.m.begin2 () is either dereferenceable or -past-the-end. It is past-the-end if and only if m.size2 () == -0.
End of rangem.end1 () Returns an iterator pointing one past the last element in the -matrix expression.m.end1 () is past-the-end.
m.end2 () Returns an iterator pointing one past the last element in the -matrix expression.m.end2 () is past-the-end.
Sizem.size1 () Returns the number of rows of the matrix expression.m.size1 () >= 0
m.size2 () Returns the number of columns of the matrix expression.m.size2 () >= 0
Swapm1.swap (m2) Equivalent to swap (m1, m2). 
Beginning of reverse rangem.rbegin1 () Equivalent to reverse_iterator1 (m.end1 ()).m.rbegin1 () is either dereferenceable or -past-the-end. It is past-the-end if and only if m.size1 () == -0.
m.rbegin2 () Equivalent to reverse_iterator2 (m.end2 ()).m.rbegin2 () is either dereferenceable or -past-the-end. It is past-the-end if and only if m.size2 () == -0.
End of reverse rangem.rend1 () Equivalent to reverse_iterator1 (m.begin1 -()).m.rend1 () is past-the-end.
m.rend2 () Equivalent to reverse_iterator2 (m.begin2 -()).m.rend2 () is past-the-end.
Element accessm (i, j)0 <= i < m.size1 () and 0 <= j < -m.size2 ()Returns the j-th element of the i-th -row of the matrix expression. 
Assignmentm2 = m1m1.size1 () == m2.size1 () and
-m1.size2 () == m2.size2 ()
Assigns every element of the evaluated matrix expression -m1 to the corresponding element of m2 -. 
m2.assign (m1)m1.size1 () == m2.size1 () and
-m1.size2 () == m2.size2 ()
Assigns every element of m1 to the corresponding -element of m2. 
Computed assignmentm2 += m1m1.size1 () == m2.size1 () and
-m1.size2 () == m2.size2 ()
Adds every element of the evaluated matrix expression -m1 to the corresponding element of -m2. 
m2.plus_assign (m1)m1.size1 () == m2.size1 () and
-m1.size2 () == m2.size2 ()
Adds every element of m1 to the corresponding -element of m2. 
m2 -= m1m1.size1 () == m2.size1 () and
-m1.size2 () == m2.size2 ()
Subtracts every element of the evaluated matrix expression -m1 from the corresponding element of m2 -. 
m2.minus_assign (m1)m1.size1 () == m2.size1 () and
-m1.size2 () == m2.size2 ()
Subtracts every element of m1 from the -corresponding element of m2. 
m *= t Multiplies every element of m with t -. 
-

Complexity guarantees

-

The run-time complexity of begin1 (), begin2 -() , end1 () and end2 () is -specific for the evaluated matrix expression.

-

The run-time complexity of size1 () and size2 -() is constant time.

-

The run-time complexity of swap () is specific for -the evaluated matrix expression, typically constant time.

-

The run-time complexity of rbegin1 (), -rbegin2 () , rend1 () and rend2 -() is specific for the evaluated matrix expression.

-

The run-time complexity of the element access is specific for -the evaluated matrix expression, typically amortized constant time -for the dense and logarithmic for the sparse case.

-

The run-time complexity of the arithmetic operations is specific -for the evaluated matrix expressions, typically quadratic in the -size of the proxies.

-

Invariants

- - - - - - - - - - - - - - - - - - - -
Valid rangeFor any matrix expression m, [m.begin1 (), -m.end1 ()) and [m.begin2 (), m.end2 ()) are -valid ranges.
CompletenessAn algorithm that iterates through the range [m.begin1 -(), m.end1 ()) will pass through every row of m -, an algorithm that iterates through the range [m.begin2 (), -m.end2 ()) will pass through every column of m -.
Valid reverse range[m.rbegin1 (), m.rend1 ()) and [m.rbegin2 -(), m.rend2 ()) are valid ranges.
Equivalence of rangesThe distance from m.begin1 () to m.end1 -() is the same as the distance from m.rbegin1 -() to m.rend1 () and the distance from -m.begin2 () to m.end2 () is the same as -the distance from m.rbegin2 () to m.rend2 -().
-

Models

-
    -
  • matrix_range
  • -
  • matrix_slice;
  • -
  • triangular_adaptor
  • -
  • symmetric_adaptor
  • -
  • banded_adaptor
  • -
  • vector_matrix_binary
  • -
  • matrix_unary1
  • -
  • matrix_unary2
  • -
  • matrix_binary
  • -
  • matrix_binary_scalar1
  • -
  • matrix_binary_scalar2
  • -
  • matrix_matrix_binary
  • -
-
-

Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
- 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 - ). -

- - - diff --git a/doc/hermitian.html b/doc/hermitian.html deleted file mode 100644 index f6a4f62ae..000000000 --- a/doc/hermitian.html +++ /dev/null @@ -1,597 +0,0 @@ - - - - - - - - - -Hermitian Matrix - - -

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ParameterDescriptionDefault
TThe type of object stored in the matrix.
F1Functor describing the type of the hermitian matrix. [1]lower
F2Functor describing the storage organization. [2]row_major
AThe 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_container<hermitian_matrix<T, F1, F2, A> ->

-

Members

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MemberDescription
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, bool preserve = -true)Reallocates a hermitian_matrix to hold -size rows of size elements. The existing -elements of the hermitian_matrix are preseved when -specified.
size_type size1 () constReturns the number of rows.
size_type size2 () constReturns the number of columns.
const_reference operator () (size_type i, size_type j) -constReturns 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 () constReturns a const_iterator1 pointing to the -beginning of the hermitian_matrix.
const_iterator1 end1 () constReturns 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 () constReturns a const_iterator2 pointing to the -beginning of the hermitian_matrix.
const_iterator2 end2 () constReturns 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 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed hermitian_matrix.
const_reverse_iterator1 rend1 () constReturns 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 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed hermitian_matrix.
const_reverse_iterator2 rend2 () constReturns 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> .

-

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

- - - - - - - - - - - - - - - - - - -
ParameterDescriptionDefault
MThe type of the adapted matrix.
FFunctor 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

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

-
-

Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
- 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 - ). -

- - - diff --git a/doc/index.html b/doc/index.html deleted file mode 100644 index bedf58133..000000000 --- a/doc/index.html +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - - - - - -Boost Basic Linear Algebra - - -

logoBasic Linear Algebra Library

-
- -

uBLAS is a C++ template class library that provides BLAS level 1, 2, 3 -functionality for dense, packed and sparse matrices. The design and implementation unify mathematical notation via -operator overloading and efficient code generation via expression templates.

- -

Functionality

- -

uBLAS provides templated C++ classes for dense, unit and sparse vectors, dense, identity, triangular, banded, -symmetric, hermitian and sparse matrices. Views into vectors and matrices can be constructed via ranges, slices, -adaptor classes and indirect arrays. The library covers the usual basic linear algebra operations on vectors and matrices: reductions like -different norms, addition and subtraction of vectors and matrices and multiplication with a scalar, inner and outer -products of vectors, matrix vector and matrix matrix products and triangular solver. The glue between containers, views -and expression templated operations is a mostly STL conforming iterator interface.

- -

Documentation

- - - -

Release notes

-Release notes can be found here. - - -

Known limitations

- -
    -
  • The implementation assumes a linear memory address model.
  • - -
  • Tuning was focussed on dense matrices.
  • -
- -

Further Information

- - - -

Authors and Credits

- -

uBLAS initially was written by Joerg Walter and Mathias Koch. We would like to thank all, which supported and -contributed to the development of this library: David Abrahams, Ed Brey, Fernando Cacciola, Juan Jose Gomez Cadenas, -Beman Dawes, Matt Davies, Bob Fletcher, Kresimir Fresl, Joachim Kessel, Patrick Kowalzick, Toon Knapen, Hendrik Kueck, -John Maddock, Jens Maurer, Alexei Novakov, Gary Powell, Joachim Pyras, Peter Schmitteckert, Jeremy Siek, Markus Steffl, -Michael Stevens, Benedikt Weber, Martin Weiser, Gunter Winkler, Marc Zimmermann, Marco Guazzone, Nasos Iliopoulus, the members of Boost and all others contributors around the world. I promise I will try to add their names to this list.

-

-This library is currently maintained by David Bellot and Stefan Seefeld. - -

Frequently Asked Questions

- -

Q: Should I use uBLAS for new projects?
-A: At the time of writing (09/2012) there are a lot of good matrix libraries available, e.g., -MTL4, -armadillo, -eigen. uBLAS offers a stable, well tested set of vector and -matrix classes, the typical operations for linear algebra and solvers for triangular systems of equations. uBLAS offers -dense, structured and sparse matrices - all using similar interfaces. And finally uBLAS offers good (but not outstanding) -performance. On the other side, the last major improvement of uBLAS was in 2008 and no significant change was committed -since 2009. So one should ask himself some questions to aid the decision: Availability? uBLAS is part of boost -and thus available in many environments. Easy to use? uBLAS is easy to use for simple things, but needs decent -C++ knowledge when you leave the path. Performance? There are faster alternatives. Cutting edge? uBLAS -is more than 10 years old and missed all new stuff from C++11.

- -

Q: I'm running the uBLAS dense vector and matrix benchmarks. Why do I see a significant performance difference -between the native C and library implementations?
-A: uBLAS distinguishes debug mode (size and type conformance checks enabled, expression templates disabled) and release -mode (size and type conformance checks disabled, expression templates enabled). Please check, if the preprocessor -symbol NDEBUG of cassert is defined. NDEBUG enables release mode, which in turn -uses expression templates. You can optionally define BOOST_UBLAS_NDEBUG to disable all bounds, structure -and similar checks of uBLAS.

- -

Q: I've written some uBLAS tests, which try to incorrectly assign different matrix types or overrun vector and -matrix dimensions. Why don't I get a compile time or runtime diagnostic?
-A: uBLAS distinguishes debug mode (size and type conformance checks enabled, expression templates disabled) and release -mode (size and type conformance checks disabled, expression templates enabled). Please check, if the preprocessor -symbol NDEBUG of cassert is defined. NDEBUG disables debug mode, which is needed -to get size and type conformance checks.

- -

Q: I've written some uBLAS benchmarks to measure the performance of matrix chain multiplications like prod (A, -prod (B, C)) and see a significant performance penalty due to the use of expression templates. How can I disable -expression templates?
-A: You do not need to disable expression templates. Please try reintroducing temporaries using either prod -(A, matrix_type (prod (B, C))) or prod (A, -prod<matrix_type > (B, C)).

- -
- -

Copyright (©) 2000-2011 Joerg Walter, Mathias Koch, Gunter Winkler, David Bellot
-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 -).

- - - diff --git a/doc/iterator_concept.html b/doc/iterator_concept.html deleted file mode 100644 index c9e4c9951..000000000 --- a/doc/iterator_concept.html +++ /dev/null @@ -1,1168 +0,0 @@ - - - - - - - - - -Iterator Concepts - - -

Iterator Concepts

-
-

An Iterator is a restricted pointer-like object pointing into a -vector or matrix container.

-

Indexed Bidirectional Iterator

-

Description

-

An Indexed Bidirectional Iterator is an iterator of a container -that can be dereferenced, incremented, decremented and carries -index information.

-

Refinement of

-

Assignable, Equality Comparable, Default Constructible.

-

Associated types

- - - - - - - - - - - -
Value typeThe type of the value obtained by dereferencing a Indexed -Bidirectional Iterator
Container typeThe type of the container a Indexed Bidirectional Iterator -points into.
-

Notation

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
IA type that is a model of Indexed Bidirectional Iterator
TThe value type of I
CThe container type of I
it, itt, it1, it2Objects of type I
tObject of type T
cObject of type C
-

Definitions

-

A Indexed Bidirectional Iterator may be mutable, meaning -that the values referred to by objects of that type may be -modified, or constant , meaning that they may not. If an -iterator type is mutable, this implies that its value type is a -model of Assignable; the converse, though, is not necessarily -true.

-

A Indexed Bidirectional Iterator may have a singular -value, meaning that the results of most operations, including -comparison for equality, are undefined. The only operation that is -guaranteed to be supported is assigning a nonsingular iterator to a -singular iterator.

-

A Indexed Bidirectional Iterator may have a -dereferenceable value, meaning that dereferencing it yields -a well-defined value. Dereferenceable iterators are always -nonsingular, but the converse is not true.

-

An Indexed Bidirectional Iterator is past-the-end if it -points beyond the last element of a container. Past-the-end values -are nonsingular and nondereferenceable.

-

Valid expressions

-

In addition to the expressions defined for Assignable, Equality -Comparable and Default Constructible, the following expressions -must be valid.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Default constructorI it  
Dereference*it Convertible to T.
Dereference assignment*it = tI is mutable. 
Member accessit->mT is a type for which t.m is -defined. 
Preincrement++ it I &
Postincrementit ++ I
Predecrement-- it I &
Postdecrementit -- I
Indexit.index () C::size_type
-

Expression Semantics

-

Semantics of an expression is defined only where it differs -from, or is not defined in, Assignable, Equality Comparable and -Default Constructible.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionPreconditionSemanticsPostcondition
Default constructorI it  it is singular.
Dereference*itit is dereferenceable.  
Dereference assignment*it = tSame as for *it. *it is a copy of t.
Member accessit->mit is dereferenceable.Equivalent to (*it).m 
Preincrement++ itit is dereferenceable.it is modified to point to the next element.it is dereferenceable or past-the-end. -
-&it == &++ it
.
-If it1 == it2,
-then ++ it1 == ++ it2.
Postincrementit ++Same as for ++ it.Equivalent to
-{
- I itt = it;
- ++ it;
- return itt;
-}
it is dereferenceable or past-the-end.
Predecrement-- itit is dereferenceable or past-the-end.
-There exists a dereferenceable iterator itt such that -it == ++ itt.
it is modified to point to the previous -element.it is dereferenceable.
-&it = &-- it.
-If it1 == it2,
-then -- it1 == -- it2.
-If it2 is dereferenceable and it1 == -++it2,
-then --it1 == it2.
Postdecrementit --Same as for -- it.Equivalent to
-{
- I itt = it;
- -- it;
- return itt;
-}
it is dereferenceable. 
Indexit.index ()it is dereferenceable.it.index () >= 0
-and
-it.index () < it ().size ()
If it1 == it2,
-then it1.index () == it2.index ().
-If it1 == it2,
-then it1.index () < (++ it2).index -().
-If it1 == it2,
-then it1.index () > (-- it2).index -().
-

Complexity guarantees

-

The complexity of operations on indexed bidirectional iterators -is guaranteed to be amortized constant time.

-

Invariants

- - - - - - - - - - - - - - - -
Identityit1 == it2 if and only if &*it1 == -&*it2.
Symmetry of increment and decrementIf it is dereferenceable, then ++ it; ---it; is a null operation. Similarly, -- it; ++ -it; is a null operation.
Relation between iterator index and container element -operatorIf it is dereferenceable, *it == it () -(it.index ()).
-

Models

-
    -
  • sparse_vector::iterator
  • -
-

Indexed Random Access Iterator

-

Description

-

An Indexed Random Access Iterator is an iterator of a container -that can be dereferenced, moved forward, moved backward and carries -index information.

-

Refinement of

-

LessThanComparable, Indexed Bidirectional -Iterator .

-

Associated types

- - - - - - - - - - - -
Value typeThe type of the value obtained by dereferencing a Indexed -Random Access Iterator
Container typeThe type of the container a Indexed Random Access Iterator -points into.
-

Notation

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
IA type that is a model of Indexed Random Access Iterator
TThe value type of I
CThe container type of I
it, itt, it1, it2Objects of type I
tObject of type T
nObject of type C::difference_type
-

Definitions

-

An Indexed Random Access Iterator it1 is -reachable from an Indexed Random Access Iterator -it2 if, after applying operator ++ to -it2 a finite number of times, it1 == -it2.

-

Valid expressions

-

In addition to the expressions defined for Indexed Bidirectional -Iterator , the following expressions must be valid.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Forward motionit += n I &
Iterator additionit + n I
Backward motioni -= n I &
Iterator subtractionit - n I 
Differenceit1 - it2 C::difference_type
Element operatorit [n] Convertible to T.
Element assignmentit [n] = tI is mutableConvertible to T.
-

Expression Semantics

-

Semantics of an expression is defined only where it differs -from, or is not defined in, Indexed Bidirectional -Iterator .

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionPreconditionSemanticsPostcondition
Forward motionit += nIncluding it itself, there must be n -dereferenceable or past-the-end iterators following or preceding -it, depending on whether n is positive or -negative.If n > 0, equivalent to executing ++ -it n times. If n < 0, -equivalent to executing -- it n times. If -n == 0, this is a null operation.it is dereferenceable or past-the-end.
Iterator additionit + nSame as for i += n.Equivalent to
-{
- I itt = it;
- return itt += n;
-}
Result is dereferenceable or past-the-end.
Backward motionit -= nIncluding it itself, there must be n -dereferenceable or past-the-end iterators preceding or following -it, depending on whether n is positive or -negative.Equivalent to it += (-n).it is dereferenceable or past-the-end.
Iterator subtractionit - nSame as for i -= n.Equivalent to
-{
- I itt = it;
- return itt -= n;
-}
Result is dereferenceable or past-the-end.
Differenceit1 - it2Either it1 is reachable from it2 or -it2 is reachable from it1, or both.Returns a number n such that it1 == it2 + -n 
Element operatorit [n]it + n exists and is dereferenceable.Equivalent to *(it + n) 
Element assignmenti[n] = tSame as for it [n].Equivalent to *(it + n) = t 
-

Complexity guarantees

-

The complexity of operations on indexed random access iterators -is guaranteed to be amortized constant time.

-

Invariants

- - - - - - - - - - - - - - - -
Symmetry of addition and subtractionIf it + n is well-defined, then it += n; it --= n; and (it + n) - n are null operations. -Similarly, if it - n is well-defined, then it -= -n; it += n; and (it - n) + n are null -operations.
Relation between distance and additionIf it1 - it2 is well-defined, then it1 == -it2 + (it1 - it2).
Reachability and distanceIf it1 is reachable from it2, then -it1 - it2 >= 0.
-

Models

-
    -
  • vector::iterator
  • -
-

Indexed Bidirectional Column/Row Iterator

-

Description

-

An Indexed Bidirectional Column/Row Iterator is an iterator of a -container that can be dereferenced, incremented, decremented and -carries index information.

-

Refinement of

-

Assignable, Equality Comparable, Default Constructible.

-

Associated types

- - - - - - - - - - - -
Value typeThe type of the value obtained by dereferencing a Indexed -Bidirectional Column/Row Iterator
Container typeThe type of the container a Indexed Bidirectional Column/Row -Iterator points into.
-

Notation

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I1A type that is a model of Indexed Bidirectional Column/Row -Iterator
I2A type that is a model of Indexed Bidirectional Row/Column -Iterator
TThe value type of I1 and I2
CThe container type of I1 and I2
it1, it1t, it11, -it12Objects of type I1
it2, it2tObjects of type I2
tObject of type T
cObject of type C
-

Definitions

-

Valid expressions

-

In addition to the expressions defined for Assignable, Equality -Comparable and Default Constructible, the following expressions -must be valid.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Default constructorI1 it  
Dereference*it Convertible to T.
Dereference assignment*it = tI1 is mutable. 
Member accessit->mT is a type for which t.m is -defined. 
Preincrement++ it I1 &
Postincrementit ++ I1
Predecrement-- it I1 &
Postdecrementit -- I1
Row Indexit.index1 () C::size_type
Column Indexit.index2 () C::size_type
Row/Column Beginit.begin () I2
Row/Column Endit.end () I2
Reverse Row/Column Beginit.rbegin () reverse_iterator<I2>
Reverse Row/Column Endit.rend () reverse_iterator<I2>
-

Expression Semantics

-

Semantics of an expression is defined only where it differs -from, or is not defined in, Assignable, Equality Comparable and -Default Constructible.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionPreconditionSemanticsPostcondition
Default constructorI1 it  it is singular.
Dereference*itit is dereferenceable.  
Dereference assignment*it = tSame as for *it. *it is a copy of t.
Member accessit->mit is dereferenceable.Equivalent to (*it).m 
Preincrement++ itit is dereferenceable.it is modified to point to the next element of -the column/row, i.e. for column iterators holds
-it.index1 () < (++ it).index1 () and
-it.index2 () == (++ it).index2 (),
-for row iterators holds
-it.index1 () == (++ it).index1 () and
-it.index2 () < (++ it).index2 ().
it is dereferenceable or past-the-end. -
-&it == &++ it
.
-If it1 == it2,
-then ++ it1 == ++ it2.
Postincrementit ++Same as for ++ it.Equivalent to
-{
- I1 itt = it;
- ++ it;
- return itt;
-}
it is dereferenceable or past-the-end.
Predecrement-- itit is dereferenceable or past-the-end.
-There exists a dereferenceable iterator itt such that -it == ++ itt.
it is modified to point to the previous  -element of the column/row, i.e. for column iterators holds
-it.index1 () > (-- it).index1 () and
-it.index2 () == (-- it).index2 (),
-for row iterators holds
-it.index1 () == (-- it).index1 () and
-it.index2 () > (-- it).index2 ().
it is dereferenceable.
-&it = &-- it.
-If it1 == it2,
-then -- it1 == -- it2.
Postdecrementit --Same as for -- it.Equivalent to
-{
- I1 itt = it;
- -- it;
- return itt;
-}
it is dereferenceable. 
Row Indexit.index1 ()If it is a Row iterator then it must be dereferenceable.it.index1 () >= 0 and
-it.index1 () < it () .size1 ()
If it1 == it2,
-then it1.index1 () == 12.index1 ().
-If it1, it2 are Row Iterators with it1 == it2,
-then it1.index1 () < (++ it2).index1 ().
-and it1.index1 () > (-- it2).index1 ().
Column Indexit.index2 ()If it is a Column iterator then it must be dereferenceable.it.index2 () >= 0 and
-it.index2 () < it () .size2 ()
If it1 == it2,
-then it1.index2 () == it2.index2 () -.
-If it1, it2 are Column Iterators with it1 == i12,
-then it1.index2 () < (++ it2).index2 ().
-end it1.index2 () > (-- it2).index2 ().
Row/Column Beginit.begin ()it is dereferenceable.If it is a Column Iterator,
-then it2 = it.begin () is a Row Iterator
-with it2.index1 () == it.index1 (). -

If it is a Row Iterator,
-then it2 = it.begin () is a Column Iterator
-with it2.index2 () == it.index2 ().

-
 
Row/Column Endit.end ()it is dereferenceable.If it is a Column Iterator,
-then it2 = it.end () is a Row Iterator
-with it2.index1 () == it.index1 (). -

If it is a Row Iterator,
-then it2 = it.end () is a Column Iterator
-with it2.index2 () == it.index2 ().

-
 
Reverse Row/Column Beginit.rbegin ()it is dereferenceable.Equivalent to reverse_iterator<I2> (it.end -()). 
Reverse Row/Column Endit.rend ()it is dereferenceable.Equivalent to reverse_iterator<I2> (it.begin -()). 
-

Complexity guarantees

-

The complexity of operations on indexed bidirectional column/row -iterators is guaranteed to be logarithmic depending on the size of -the container. The complexity of one iterator (depending on the -storage layout) can be lifted to be amortized constant time. The -complexity of the other iterator (depending on the storage layout -and the container) can be lifted to be amortized constant time for -the first row/first column respectively.

-

Invariants

- - - - - - - - - - - - - - - - - - - - - - - -
Identityit1 == it2 if and only if &*it1 == -&*it2.
Symmetry of increment and decrementIf it is dereferenceable, then ++ it; ---it; is a null operation. Similarly, -- it; ++ -it; is a null operation.
Relation between iterator index and container element -operatorIf it is dereferenceable, *it == it () -(it.index1 (), it.index2 ())
Relation between iterator column/row begin and iterator -indexIf it is a Column Iterator -and it2 = it.begin () then it2.index2 () < -it2t.index2 () for all it2t with it2t () -== it2 () and it2t ().index1 () == it2 ().index1 -(). -

If it is a Row Iterator and -it2 = it.begin () then it2.index1 () < -it2t.index1 () for all it2t with it2t () -== it2 () and it2t ().index2 () == it2 ().index2 -().

-
Relation between iterator column/row end and iterator -indexIf it is a Column Iterator -and it2 = it.end () then it2.index2 () > -it2t.index2 () for all it2t with it2t () -== it2 () and it2t ().index1 () == it2 ().index1 -(). -

If it is a Row Iterator and -it2 = it.end () then it2.index1 () > -it2t.index1 () for all it2t with it2t () -== it2 () and it2t ().index2 () == it2 ().index2 -().

-
-

Models

-
    -
  • sparse_matrix::iterator1
  • -
  • sparse_matrix::iterator2
  • -
-

Indexed Random Access Column/Row Iterator

-

Description

-

An Indexed Random Access Column/Row Iterator is an iterator of a -container that can be dereferenced, incremented, decremented and -carries index information.

-

Refinement of

-

Indexed -Bidirectional Column/Row Iterator .

-

Associated types

- - - - - - - - - - - -
Value typeThe type of the value obtained by dereferencing a Indexed -Random Access Column/Row Iterator
Container typeThe type of the container a Indexed Random Access Column/Row -Iterator points into.
-

Notation

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
IA type that is a model of Indexed Random Access Column/Row -Iterator
TThe value type of I
CThe container type of I
it, itt, it1, it2Objects of type I
tObject of type T
cObject of type C
-

Definitions

-

Valid expressions

-

In addition to the expressions defined for Indexed Bidirectional -Column/Row Iterator , the following expressions must be -valid.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Forward motionit += n I &
Iterator additionit + n I
Backward motioni -= n I &
Iterator subtractionit - n I 
Differenceit1 - it2 C::difference_type
Element operatorit [n] Convertible to T.
Element assignmentit [n] = tI is mutableConvertible to T.
-

Expression Semantics

-

Semantics of an expression is defined only where it differs -from, or is not defined in, Indexed Bidirectional -Column/Row Iterator .

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionPreconditionSemanticsPostcondition
Forward motionit += nIncluding it itself, there must be n -dereferenceable or past-the-end iterators following or preceding -it, depending on whether n is positive or -negative.If n > 0, equivalent to executing ++ -it n times. If n < 0, -equivalent to executing -- it n times. If -n == 0, this is a null operation.it is dereferenceable or past-the-end.
Iterator additionit + nSame as for i += n.Equivalent to
-{
- I itt = it;
- return itt += n;
-}
Result is dereferenceable or past-the-end.
Backward motionit -= nIncluding it itself, there must be n -dereferenceable or past-the-end iterators preceding or following -it, depending on whether n is positive or -negative.Equivalent to it += (-n).it is dereferenceable or past-the-end.
Iterator subtractionit - nSame as for i -= n.Equivalent to
-{
- I itt = it;
- return itt -= n;
-}
Result is dereferenceable or past-the-end.
Differenceit1 - it2Either it1 is reachable from it2 or -it2 is reachable from it1, or both.Returns a number n such that it1 == it2 + -n 
Element operatorit [n]it + n exists and is dereferenceable.Equivalent to *(it + n) 
Element assignmenti[n] = tSame as for it [n].Equivalent to *(it + n) = t 
-

Complexity guarantees

-

The complexity of operations on indexed random access Column/Row -iterators is guaranteed to be amortized constant time.

-

Invariants

- - - - - - - - - - - - - - - -
Symmetry of addition and subtractionIf it + n is well-defined, then it += n; it --= n; and (it + n) - n are null operations. -Similarly, if it - n is well-defined, then it -= -n; it += n; and (it - n) + n are null -operations.
Relation between distance and additionIf it1 - it2 is well-defined, then it1 == -it2 + (it1 - it2).
Reachability and distanceIf it1 is reachable from it2, then -it1 - it2 >= 0.
-

Models

-
    -
  • matrix::iterator1
  • -
  • matrix::iterator2
  • -
-
-

Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
- 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 - ). -

- - - diff --git a/doc/js/jquery-1.3.2.min.js b/doc/js/jquery-1.3.2.min.js deleted file mode 100644 index b1ae21d8b..000000000 --- a/doc/js/jquery-1.3.2.min.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * jQuery JavaScript Library v1.3.2 - * http://jquery.com/ - * - * Copyright (c) 2009 John Resig - * Dual licensed under the MIT and GPL licenses. - * http://docs.jquery.com/License - * - * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) - * Revision: 6246 - */ -(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
"]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); -/* - * Sizzle CSS Selector Engine - v0.9.3 - * Copyright 2009, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/doc/js/jquery.toc-gw.js b/doc/js/jquery.toc-gw.js deleted file mode 100644 index d48dd4be6..000000000 --- a/doc/js/jquery.toc-gw.js +++ /dev/null @@ -1,166 +0,0 @@ -/*! - * jQuery TOC Plugin v1.1.x based on - * samaxesJS JavaScript Library - * http://code.google.com/p/samaxesjs/ - * - * Copyright (c) 2008 samaxes.com - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * 2009-10-04, guwi17: modified and extended to meet uBLAS' needs - */ - -(function($) { - /* - * The TOC plugin dynamically builds a table of contents from the headings in - * a document and prepends legal-style section numbers to each of the headings. - */ - $.fn.toc = function(options) { - var opts = $.extend({}, $.fn.toc.defaults, options); - - return this.each(function() { - var toc = $(this).append('
    ').children('ul'); - var headers = {h1: 0, h2: 0, h3: 0, h4: 0, h5: 0, h6: 0}; - var index = 0; - var indexes = { - h1: (opts.exclude.match('h1') == null && $('h1').length > 0) ? ++index : 0, - h2: (opts.exclude.match('h2') == null && $('h2').length > 0) ? ++index : 0, - h3: (opts.exclude.match('h3') == null && $('h3').length > 0) ? ++index : 0, - h4: (opts.exclude.match('h4') == null && $('h4').length > 0) ? ++index : 0, - h5: (opts.exclude.match('h5') == null && $('h5').length > 0) ? ++index : 0, - h6: (opts.exclude.match('h6') == null && $('h6').length > 0) ? ++index : 0 - }; - - $(':header').not(opts.exclude).each(function() { - var linkId = ""; - if ($(this).is('h6')) { - checkContainer(headers.h6, toc); - updateNumeration(headers, 'h6'); - $(this).text(addNumeration(headers, 'h6', $(this).text())); - linkId = fixAnchor($(this)); - appendToTOC(toc, indexes.h6, linkId, $(this).text(), headers); - } else if ($(this).is('h5')) { - checkContainer(headers.h5, toc); - updateNumeration(headers, 'h5'); - $(this).text(addNumeration(headers, 'h5', $(this).text())); - linkId = fixAnchor($(this)); - appendToTOC(toc, indexes.h5, linkId, $(this).text(), headers); - } else if ($(this).is('h4')) { - checkContainer(headers.h4, toc); - updateNumeration(headers, 'h4'); - $(this).text(addNumeration(headers, 'h4', $(this).text())); - linkId = fixAnchor($(this)); - appendToTOC(toc, indexes.h4, linkId, $(this).text(), headers); - } else if ($(this).is('h3')) { - checkContainer(headers.h3, toc); - updateNumeration(headers, 'h3'); - $(this).text(addNumeration(headers, 'h3', $(this).text())); - linkId = fixAnchor($(this)); - appendToTOC(toc, indexes.h3, linkId, $(this).text(), headers); - } else if ($(this).is('h2')) { - checkContainer(headers.h2, toc); - updateNumeration(headers, 'h2'); - $(this).text(addNumeration(headers, 'h2', $(this).text())); - linkId = fixAnchor($(this)); - appendToTOC(toc, indexes.h2, linkId, $(this).text(), headers); - } else if ($(this).is('h1')) { - updateNumeration(headers, 'h1'); - $(this).text(addNumeration(headers, 'h1', $(this).text())); - linkId = fixAnchor($(this)); - appendToTOC(toc, indexes.h1, linkId, $(this).text(), headers); - } - }); - }); - }; - - /* - * Checks if the last node is an 'ul' element. - * If not, a new one is created. - */ - function checkContainer(header, toc) { - if (header == 0 && !toc.find(':last').is('ul')) { - toc.find('li:last').append('
      '); - } - }; - - /* - * Updates headers numeration. - */ - function updateNumeration(headers, header) { - $.each(headers, function(i, val) { - if (i == header) { - ++headers[i]; - } else if (i > header) { - headers[i] = 0; - } - }); - }; - - /* - * Prepends the numeration to a heading. - */ - function addNumeration(headers, header, text) { - var numeration = ''; - - $.each(headers, function(i, val) { - if (i <= header && headers[i] > 0) { - numeration += headers[i] + '.'; - } - }); - - return removeFinalDot(numeration) + ' ' + text; - }; - - function removeFinalDot(text) { - return (text||"").replace(/\.$/g, "" ) - } - - function fixAnchor(element) { - // use existing id by default - var linkId = element.attr('id'); - // next, look for an anchor and use its id or name - if ( !linkId ) { - element.find('> a:first').each( function() { - linkId = $(this).attr('id') || $(this).attr('name'); - }); - } - // next, use the text content as last resort - if ( !linkId ) { - linkId = (element.text()||"unknown").replace(/[^a-zA-Z0-9]/g,""); - } - - element.attr('id',linkId); - return linkId; - } - - /* - * Appends a new node to the TOC. - */ - function appendToTOC(toc, index, id, text, headers) { - var parent = toc; - - for (var i = 1; i < index; i++) { - if (parent.find('> li:last > ul').length == 0) { - parent = parent.append('
      • '); - } - parent = parent.find('> li:last > ul'); - } - if (id) { - parent.append('
      • ' + text + '
      • '); - } else { - parent.append('
      • ' + text + '
      • '); - } - }; - - $.fn.toc.defaults = {exclude: 'h1, h5, h6'} -})(jQuery); diff --git a/doc/matrix.html b/doc/matrix.html deleted file mode 100644 index 0342d04a2..000000000 --- a/doc/matrix.html +++ /dev/null @@ -1,768 +0,0 @@ - - - - - - - - - -Matrix - - -

        Matrix

        -
        -

        Matrix

        -

        Description

        -

        The templated class matrix<T, F, A> is the -base container adaptor for dense matrices. For a (m x -n)-dimensional matrix and 0 <= i < m, 0 -<= j < n every element mi, -j is mapped to the (i x n + j)-th element of -the container for row major orientation or the (i + j x -m)-th element of the container for column major -orientation.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i)
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            m (i, j) = 3 * i + j;
        -    std::cout << m << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the matrix.
        FFunctor describing the storage organization. [1]row_major
        AThe type of the Storage array. [2]unbounded_array<T>
        -

        Model of

        -

        Matrix .

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_container<matrix<T, F, A> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix ()Allocates an uninitialized matrix that holds zero -rows of zero elements.
        matrix (size_type size1, size_type size2)Allocates an uninitialized matrix that holds -size1 rows of size2 elements.
        matrix (const matrix &m)The copy constructor.
        template<class AE>
        -matrix (const matrix_expression<AE> &ae)
        The extended copy constructor.
        void resize (size_type size1, size_type size2, bool -preserve = true)Reallocates a matrix to hold size1 -rows of size2 elements. The existing elements of the -matrix are preseved when specified.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const array_type& data () const
        array_type& data ()
        const_reference operator () (size_type i, size_type j) -constReturns 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.
        matrix &operator = (const matrix &m)The assignment operator.
        matrix &assign_temporary (matrix &m)Assigns a temporary. May change the matrix m.
        template<class AE>
        -matrix &operator = (const matrix_expression<AE> -&ae)
        The extended assignment operator.
        template<class AE>
        -matrix &assign (const matrix_expression<AE> -&ae)
        Assigns a matrix expression to the matrix. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -matrix &operator += (const matrix_expression<AE> -&ae)
        A computed assignment operator. Adds the matrix expression to -the matrix.
        template<class AE>
        -matrix &plus_assign (const matrix_expression<AE> -&ae)
        Adds a matrix expression to the matrix. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -matrix &operator -= (const matrix_expression<AE> -&ae)
        A computed assignment operator. Subtracts the matrix expression -from the matrix.
        template<class AE>
        -matrix &minus_assign (const matrix_expression<AE> -&ae)
        Subtracts a matrix expression from the matrix. Left and right -hand side of the assignment should be independent.
        template<class AT>
        -matrix &operator *= (const AT &at)
        A computed assignment operator. Multiplies the matrix with a -scalar.
        template<class AT>
        -matrix &operator /= (const AT &at)
        A computed assignment operator. Divides the matrix through a -scalar.
        void swap (matrix &m)Swaps the contents of the matrices.
        void insert_element (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_element (size_type i, size_type j)Erases the value at the j-th element of the -i-th row.
        void clear ()Clears the matrix.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the matrix.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the matrix.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the matrix.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -matrix.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the matrix.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the matrix.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the matrix.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -matrix.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed matrix.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed matrix.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed matrix.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed matrix.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed matrix.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed matrix.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed matrix.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed matrix.
        -

        Notes

        -

        [1] Supported parameters -for the storage organization are row_major and -column_major.

        -

        [2] Common parameters -for the storage array are unbounded_array<T> , -bounded_array<T> and -std::vector<T> .

        -

        Identity Matrix

        -

        Description

        -

        The templated class identity_matrix<T, ALLOC> -represents identity matrices. For a (m x n)-dimensional -identity matrix and 0 <= i < m, 0 <= j < -n holds idi, j = 0, if -i <> j, and idi, i= -1.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    identity_matrix<double> m (3);
        -    std::cout << m << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the matrix.int
        ALLOCAn STL Allocator for size_type and difference_type.std::allocator
        -

        Model of

        -

        Matrix .

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_container<identity_matrix<T> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        identity_matrix ()Constructs an identity_matrix that holds zero rows -of zero elements.
        identity_matrix (size_type size)Constructs an identity_matrix that holds -size rows of size elements.
        identity_matrix (const identity_matrix -&m)The copy constructor.
        void resize (size_type size, bool preserve = -true)Resizes a identity_matrix to hold -size rows of size elements. Therefore the -existing elements of the itendity_matrix are always -preseved.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value of the j-th element in the -i-th row.
        identity_matrix &operator = (const identity_matrix -&m)The assignment operator.
        identity_matrix &assign_temporary (identity_matrix -&m)Assigns a temporary. May change the identity matrix -m .
        void swap (identity_matrix &m)Swaps the contents of the identity matrices.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the identity_matrix.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the identity_matrix.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the identity_matrix.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the identity_matrix.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed identity_matrix.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed identity_matrix.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed identity_matrix.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed identity_matrix.
        -

        Zero Matrix

        -

        Description

        -

        The templated class zero_matrix<T, ALLOC> represents -zero matrices. For a (m x n)-dimensional zero matrix and -0 <= i < m, 0 <= j < n holds -zi, j = 0.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    zero_matrix<double> m (3, 3);
        -    std::cout << m << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the matrix.int
        ALLOCAn STL Allocator for size_type and difference_type.std::allocator
        -

        Model of

        -

        Matrix .

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_container<zero_matrix<T> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        zero_matrix ()Constructs a zero_matrix that holds zero rows of -zero elements.
        zero_matrix (size_type size1, size_type -size2)Constructs a zero_matrix that holds -size1 rows of size2 elements.
        zero_matrix (const zero_matrix &m)The copy constructor.
        void resize (size_type size1, size_type size2, bool -preserve = true)Resizes a zero_matrix to hold size1 -rows of size2 elements. Therefore the existing -elements of the zero_matrix are always preseved.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value of the j-th element in the -i-th row.
        zero_matrix &operator = (const zero_matrix -&m)The assignment operator.
        zero_matrix &assign_temporary (zero_matrix -&m)Assigns a temporary. May change the zero matrix m -.
        void swap (zero_matrix &m)Swaps the contents of the zero matrices.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the zero_matrix.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the zero_matrix.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the zero_matrix.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the zero_matrix.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed zero_matrix.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed zero_matrix.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed zero_matrix.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed zero_matrix.
        -

        Scalar Matrix

        -

        Description

        -

        The templated class scalar_matrix<T, ALLOC> -represents scalar matrices. For a (m x n)-dimensional -scalar matrix and 0 <= i < m, 0 <= j < -n holds zi, j = s.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    scalar_matrix<double> m (3, 3);
        -    std::cout << m << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the matrix.int
        ALLOCAn STL Allocator for size_type and difference_type.std::allocator
        -

        Model of

        -

        Matrix .

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_container<scalar_matrix<T> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        scalar_matrix ()Constructs a scalar_matrix that holds scalar rows -of zero elements.
        scalar_matrix (size_type size1, size_type size2, const -value_type &value)Constructs a scalar_matrix that holds -size1 rows of size2 elements each of the -specified value.
        scalar_matrix (const scalar_matrix &m)The copy constructor.
        void resize (size_type size1, size_type size2, bool -preserve = true)Resizes a scalar_matrix to hold size1 -rows of size2 elements. Therefore the existing -elements of the scalar_matrix are always -preseved.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value of the j-th element in the -i-th row.
        scalar_matrix &operator = (const scalar_matrix -&m)The assignment operator.
        scalar_matrix &assign_temporary (scalar_matrix -&m)Assigns a temporary. May change the scalar matrix -m .
        void swap (scalar_matrix &m)Swaps the contents of the scalar matrices.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the scalar_matrix.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the scalar_matrix.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the scalar_matrix.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the scalar_matrix.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed scalar_matrix.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed scalar_matrix.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed scalar_matrix.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed scalar_matrix.
        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/matrix_expression.html b/doc/matrix_expression.html deleted file mode 100644 index a9798142d..000000000 --- a/doc/matrix_expression.html +++ /dev/null @@ -1,1428 +0,0 @@ - - - - - - - - - -Matrix Expressions - - -

        Matrix Expressions

        -
        -

        Matrix Expression

        -

        Description

        -

        The templated class matrix_expression<E> -is required to be a public base of all classes which model the Matrix Expression concept.

        -

        Definition

        -

        Defined in the header expression_types.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        EThe type of the matrix expression. 
        -

        Model of

        -

        None. Not a Matrix Expression! -

        -

        Type requirements

        -

        None.

        -

        Public base classes

        -

        None.

        -

        Members

        - - - - - - - - - - - - - - - -
        MemberDescription
        const expression_type &operator () () -constReturns a const reference of the expression.
        expression_type &operator () ()Returns a reference of the expression.
        -

        Notes

        -

        The operator[], row, column, range, slice and project functions have been removed. Use the free functions defined in matrix proxy instead.

        -

        Matrix Container

        -

        Description

        -

        The templated class matrix_container<C> -is required to be a public base of all classes which model the Matrix concept. -This includes the class matrix itself.

        -

        Definition

        -

        Defined in the header expression_types.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        EThe type of the matrix expression. 
        -

        Model of

        -

        None. Not a Matrix Expression OR Matrix! -

        -

        Type requirements

        -

        None.

        -

        Public base classes

        -

        matrix_expression<C>

        -

        Members

        - - - - - - - - - - - - - - - -
        MemberDescription
        const container_type &operator () () -constReturns a const reference of the container.
        container_type &operator () ()Returns a reference of the container.
        -

        Matrix References

        -

        Reference

        -

        Description

        -

        The templated class matrix_reference<E> -contains a reference to a matrix expression.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        EThe type of the matrix expression. 
        -

        Model of

        -

        Matrix Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_expression<matrix_reference<E> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_reference (expression_type &e)Constructs a constant reference of the expression.
        void resize (size_type size1, size2)Resizes the expression to hold at most size1 rows -of size2 elements.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value 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.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the expression.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the expression.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the expression.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -expression.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the expression.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the expression.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the expression.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -expression.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed expression.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed expression.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed expression.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed expression.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed expression.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed expression.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed expression.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed expression.
        -

        Matrix Operations

        -

        Unary Operation Description

        -

        Description

        -

        The templated classes matrix_unary1<E, F> and -matrix_unary2<E, F> describe unary matrix -operations.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        EThe type of the matrix expression. 
        FThe type of the operation. 
        -

        Model of

        -

        Matrix Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_expression<matrix_unary1<E, F> > -and matrix_expression<matrix_unary2<E, F> -> resp.

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_unary1 (const expression_type &e)Constructs a description of the expression.
        matrix_unary2 (const expression_type &e)Constructs a description of the expression.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value of the j-th element in the -i-th row.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the expression.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the expression.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the expression.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the expression.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed expression.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed expression.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed expression.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed expression.
        -

        Unary Operations

        -

        Prototypes

        -
        -template<class E, class F>
        -    struct matrix_unary1_traits {
        -        typedef matrix_unary1<typename E::const_closure_type, F> expression_type;
        -        typedef expression_type result_type;
        -     };
        -
        -    // (- m) [i] [j] = - m [i] [j]
        -    template<class E>
        -     typename matrix_unary1_traits<E, scalar_negate<typename E::value_type> >::result_type
        -    operator - (const matrix_expression<E> &e);
        -
        -    // (conj m) [i] [j] = conj (m [i] [j])
        -    template<class E>
        -     typename matrix_unary1_traits<E, scalar_conj<typename E::value_type> >::result_type
        -    conj (const matrix_expression<E> &e);
        -
        -    // (real m) [i] [j] = real (m [i] [j])
        -    template<class E>
        -     typename matrix_unary1_traits<E, scalar_real<typename E::value_type> >::result_type
        -    real (const matrix_expression<E> &e);
        -
        -    // (imag m) [i] [j] = imag (m [i] [j])
        -    template<class E>
        -     typename matrix_unary1_traits<E, scalar_imag<typename E::value_type> >::result_type
        -    imag (const matrix_expression<E> &e);
        -
        -    template<class E, class F>
        -    struct matrix_unary2_traits {
        -        typedef matrix_unary2<typename E::const_closure_type, F> expression_type;
        -        typedef expression_type result_type;
        -     };
        -
        -    // (trans m) [i] [j] = m [j] [i]
        -    template<class E>
        -     typename matrix_unary2_traits<E, scalar_identity<typename E::value_type> >::result_type
        -    trans (const matrix_expression<E> &e);
        -
        -    // (herm m) [i] [j] = conj (m [j] [i])
        -    template<class E>
        -     typename matrix_unary2_traits<E, scalar_conj<typename E::value_type> >::result_type
        -    herm (const matrix_expression<E> &e);
        -
        -

        Description

        -

        operator - computes the additive inverse of a -matrix expression. conj computes the complex conjugate -of a matrix expression. real and imag -compute the real and imaginary parts of a matrix expression. -trans computes the transpose of a matrix expression. -herm computes the hermitian, i.e. the complex -conjugate of the transpose of a matrix expression.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -

        None.

        -

        Complexity

        -

        Quadratic depending from the size of the matrix expression.

        -

        Examples

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<std::complex<double> > m (3, 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i)
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            m (i, j) = std::complex<double> (3 * i + j, 3 * i + j);
        -
        -    std::cout << - m << std::endl;
        -    std::cout << conj (m) << std::endl;
        -    std::cout << real (m) << std::endl;
        -    std::cout << imag (m) << std::endl;
        -    std::cout << trans (m) << std::endl;
        -    std::cout << herm (m) << std::endl;
        -}
        -
        -

        Binary Operation Description

        -

        Description

        -

        The templated class matrix_binary<E1, E2, F> -describes a binary matrix operation.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        E1The type of the first matrix expression.
        E2The type of the second matrix expression.
        FThe type of the operation.
        -

        Model of

        -

        Matrix Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_expression<matrix_binary<E1, E2, F> ->.

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_binary (const expression1_type &e1, const -expression2_type &e2)Constructs a description of the expression.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value of the j-th element in the -i-th row.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the expression.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the expression.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the expression.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the expression.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed expression.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed expression.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed expression.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed expression.
        -

        Binary Operations

        -

        Prototypes

        -
        -template<class E1, class E2, class F>
        -    struct matrix_binary_traits {
        -        typedef matrix_binary<typename E1::const_closure_type,
        -                               typename E2::const_closure_type, F> expression_type;
        -        typedef expression_type result_type;
        -     };
        -
        -    // (m1 + m2) [i] [j] = m1 [i] [j] + m2 [i] [j]
        -    template<class E1, class E2>
        -    typename matrix_binary_traits<E1, E2, scalar_plus<typename E1::value_type,
        -                                                       typename E2::value_type> >::result_type
        -    operator + (const matrix_expression<E1> &e1,
        -                 const matrix_expression<E2> &e2);
        -
        -    // (m1 - m2) [i] [j] = m1 [i] [j] - m2 [i] [j]
        -    template<class E1, class E2>
        -    typename matrix_binary_traits<E1, E2, scalar_minus<typename E1::value_type,
        -                                                        typename E2::value_type> >::result_type
        -    operator - (const matrix_expression<E1> &e1,
        -                 const matrix_expression<E2> &e2);
        -
        -

        Description

        -

        operator + computes the sum of two matrix -expressions. operator - computes the difference of two -matrix expressions.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -
          -
        • e1 ().size1 () == e2 ().size1 ()
        • -
        • e1 ().size2 () == e2 ().size2 ()
        • -
        -

        Complexity

        -

        Quadratic depending from the size of the matrix expressions.

        -

        Examples

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m1 (3, 3), m2 (3, 3);
        -    for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)
        -        for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j)
        -            m1 (i, j) = m2 (i, j) = 3 * i + j;
        -
        -    std::cout << m1 + m2 << std::endl;
        -    std::cout << m1 - m2 << std::endl;
        -}
        -
        -

        Scalar Matrix Operation Description

        -

        Description

        -

        The templated classes matrix_binary_scalar1<E1, E2, -F> and matrix_binary_scalar2<E1, E2, -F> describe binary operations between a scalar and a -matrix.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        E1/E2The type of the scalar expression.
        E2/E1The type of the matrix expression.
        FThe type of the operation.
        -

        Model of

        -

        Matrix Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_expression<matrix_binary_scalar1<E1, E2, -F> > and -matrix_expression<matrix_binary_scalar2<E1, E2, F> -> resp.

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_binary_scalar1 (const expression1_type &e1, -const expression2_type &e2)Constructs a description of the expression.
        matrix_binary_scalar1 (const expression1_type &e1, -const expression2_type &e2)Constructs a description of the expression.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value of the j-th element in the -i-th row.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the expression.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the expression.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the expression.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the expression.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed expression.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed expression.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed expression.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed expression.
        -

        Scalar Matrix Operations

        -

        Prototypes

        -
        -template<class T1, class E2, class F>
        -    struct matrix_binary_scalar1_traits {
        -        typedef matrix_binary_scalar1<scalar_const_reference<T1>,
        -                                      typename E2::const_closure_type, F> expression_type;
        -        typedef expression_type result_type;
        -     };
        -
        -    // (t * m) [i] [j] = t * m [i] [j]
        -    template<class T1, class E2>
        -    typename matrix_binary_scalar1_traits<T1, E2, scalar_multiplies<T1, typename E2::value_type> >::result_type
        -    operator * (const T1 &e1,
        -                 const matrix_expression<E2> &e2);
        -
        -    template<class E1, class T2, class F>
        -    struct matrix_binary_scalar2_traits {
        -        typedef matrix_binary_scalar2<typename E1::const_closure_type,
        -                                      scalar_const_reference<T2>, F> expression_type;
        -        typedef expression_type result_type;
        -     };
        -
        -    // (m * t) [i] [j] = m [i] [j] * t
        -    template<class E1, class T2>
        -    typename matrix_binary_scalar2_traits<E1, T2, scalar_multiplies<typename E1::value_type, T2> >::result_type
        -    operator * (const matrix_expression<E1> &e1,
        -                 const T2 &e2);
        -
        -    // (m / t) [i] [j] = m [i] [j] / t
        -    template<class E1, class T2>
        -    typename matrix_binary_scalar2_traits<E1, T2, scalar_divides<typename E1::value_type, T2> >::result_type
        -    operator / (const matrix_expression<E1> &e1,
        -                 const T2 &e2);
        -
        -

        Description

        -

        operator * computes the product of a scalar and a -matrix expression. operator / multiplies the matrix -with the reciprocal of the scalar.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -

        None.

        -

        Complexity

        -

        Quadratic depending from the size of the matrix expression.

        -

        Examples

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i)
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            m (i, j) = 3 * i + j;
        -
        -    std::cout << 2.0 * m << std::endl;
        -    std::cout << m * 2.0 << std::endl;
        -}
        -
        -

        Matrix Vector Operations

        -

        Binary Operation Description

        -

        Description

        -

        The templated classes matrix_vector_binary1<E1, E2, -F> and matrix_vector_binary2<E1, E2, -F> describe binary matrix vector operations.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        E1The type of the matrix or vector expression.
        E2The type of the vector or matrix expression.
        FThe type of the operation.
        -

        Model of

        -

        Vector Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<matrix_vector_binary1<E1, E2, -F> > and -vector_expression<matrix_vector_binary2<E1, E2, F> -> resp.

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_vector_binary1 (const expression1_type &e1, -const expression2_type &e2)Constructs a description of the expression.
        matrix_vector_binary2 (const expression1_type &e1, -const expression2_type &e2)Constructs a description of the expression.
        size_type size () constReturns the size of the expression.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the expression.
        const_iterator end () constReturns a const_iterator pointing to the end of -the expression.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed expression.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed expression.
        -

        Binary Operations

        -

        Prototypes

        -
        -template<class T1, class E1, class T2, class E2>
        -    struct matrix_vector_binary1_traits {
        -        typedef row_major_tag dispatch_category;
        -        typedef typename promote_traits<T1, T2>::promote_type promote_type;
        -        typedef matrix_vector_binary1<typename E1::const_closure_type,
        -                                       typename E2::const_closure_type,
        -                                       matrix_vector_prod1<T1, T2, promote_type> > expression_type;
        -        typedef expression_type result_type;
        -     };
        -
        -    template<class E1, class E2>
        -    typename matrix_vector_binary1_traits<typename E1::value_type, E1,
        -                                           typename E2::value_type, E2>::result_type
        -    prod (const matrix_expression<E1> &e1,
        -           const vector_expression<E2> &e2,
        -          row_major_tag);
        -
        -    // Dispatcher
        -    template<class E1, class E2>
        -    typename matrix_vector_binary1_traits<typename E1::value_type, E1,
        -                                           typename E2::value_type, E2>::result_type
        -    prod (const matrix_expression<E1> &e1,
        -           const vector_expression<E2> &e2);
        -
        -    template<class E1, class E2>
        -    typename matrix_vector_binary1_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
        -                                           typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
        -    prec_prod (const matrix_expression<E1> &e1,
        -                const vector_expression<E2> &e2,
        -               row_major_tag);
        -
        -    // Dispatcher
        -    template<class E1, class E2>
        -    typename matrix_vector_binary1_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
        -                                           typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
        -    prec_prod (const matrix_expression<E1> &e1,
        -                const vector_expression<E2> &e2);
        -
        -    template<class V, class E1, class E2>
        -    V
        -    prod (const matrix_expression<E1> &e1,
        -          const vector_expression<E2> &e2);
        -
        -    template<class V, class E1, class E2>
        -    V
        -    prec_prod (const matrix_expression<E1> &e1,
        -               const vector_expression<E2> &e2);
        -
        -    template<class T1, class E1, class T2, class E2>
        -    struct matrix_vector_binary2_traits {
        -        typedef column_major_tag dispatch_category;
        -        typedef typename promote_traits<T1, T2>::promote_type promote_type;
        -        typedef matrix_vector_binary2<typename E1::const_closure_type,
        -                                       typename E2::const_closure_type,
        -                                       matrix_vector_prod2<T1, T2, promote_type> > expression_type;
        -        typedef expression_type result_type;
        -     };
        -
        -    template<class E1, class E2>
        -    typename matrix_vector_binary2_traits<typename E1::value_type, E1,
        -                                           typename E2::value_type, E2>::result_type
        -    prod (const vector_expression<E1> &e1,
        -           const matrix_expression<E2> &e2,
        -          column_major_tag);
        -
        -    // Dispatcher
        -    template<class E1, class E2>
        -    typename matrix_vector_binary2_traits<typename E1::value_type, E1,
        -                                           typename E2::value_type, E2>::result_type
        -    prod (const vector_expression<E1> &e1,
        -           const matrix_expression<E2> &e2);
        -
        -    template<class E1, class E2>
        -    typename matrix_vector_binary2_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
        -                                           typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
        -    prec_prod (const vector_expression<E1> &e1,
        -                const matrix_expression<E2> &e2,
        -               column_major_tag);
        -
        -    // Dispatcher
        -    template<class E1, class E2>
        -    typename matrix_vector_binary2_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
        -                                           typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
        -    prec_prod (const vector_expression<E1> &e1,
        -                const matrix_expression<E2> &e2);
        -
        -    template<class V, class E1, class E2>
        -    V
        -    prod (const vector_expression<E1> &e1,
        -          const matrix_expression<E2> &e2);
        -
        -    template<class V, class E1, class E2>
        -    V
        -    prec_prod (const vector_expression<E1> &e1,
        -               const matrix_expression<E2> &e2);
        -
        -

        Description

        -

        prod computes the product of the matrix and the -vector expression. prec_prod computes the double -precision product of the matrix and the vector expression.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -
          -
        • e1 ().size2 () == e2 ().size ()
        • -
        • e1 ().size () == e2 ().size1 ()
        • -
        -

        Complexity

        -

        Quadratic depending from the size of the matrix expression.

        -

        Examples

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    vector<double> v (3);
        -    for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) {
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            m (i, j) = 3 * i + j;
        -        v (i) = i;
        -    }
        -
        -    std::cout << prod (m, v) << std::endl;
        -    std::cout << prod (v, m) << std::endl;
        -}
        -
        -

        Triangular Solver

        -

        Prototypes

        -
        -template<class E1, class E2>
        -    struct matrix_vector_solve_traits {
        -        typedef typename promote_traits<typename E1::value_type, typename E2::value_type>::promote_type promote_type;
        -        typedef vector<promote_type> result_type;
        -    };
        -
        -    template<class E1, class E2>
        -    void inplace_solve (const matrix_expression<E1> &e1,
        -                         E2 &e2,
        -                        lower_tag,
        -                        vector_tag);
        -    template<class E1, class E2>
        -    void inplace_solve (const matrix_expression<E1> &e1,
        -                         E2 &e2,
        -                        upper_tag,
        -                        vector_tag);
        -    template<class E1, class E2>
        -    void inplace_solve (const matrix_expression<E1> &e1,
        -                         E2 &e2,
        -                        unit_lower_tag,
        -                        vector_tag);
        -    template<class E1, class E2>
        -    void inplace_solve (const matrix_expression<E1> &e1,
        -                         E2 &e2,
        -                        unit_upper_tag,
        -                        vector_tag);
        -
        -    template<class E1, class E2, class C>
        -    typename matrix_vector_solve_traits<E1, E2>::result_type
        -    solve (const matrix_expression<E1> &e1,
        -            const vector_expression<E2> &e2,
        -           C);
        -
        -    template<class E1, class E2>
        -    void inplace_solve (E1 &e1,
        -                        const matrix_expression<E2> &e2,
        -                         vector_tag,
        -                         lower_tag);
        -    template<class E1, class E2>
        -    void inplace_solve (E1 &e1,
        -                        const matrix_expression<E2> &e2,
        -                         vector_tag,
        -                         upper_tag);
        -    template<class E1, class E2>
        -    void inplace_solve (E1 &e1,
        -                        const matrix_expression<E2> &e2,
        -                         vector_tag,
        -                         unit_lower_tag);
        -    template<class E1, class E2>
        -    void inplace_solve (E1 &e1,
        -                        const matrix_expression<E2> &e2,
        -                         vector_tag,
        -                         unit_upper_tag);
        -
        -    template<class E1, class E2, class C>
        -    typename matrix_vector_solve_traits<E1, E2>::result_type
        -    solve (const vector_expression<E1> &e1,
        -            const matrix_expression<E2> &e2,
        -           C);
        -
        -

        Description

        -

        solve solves a linear equation for lower or upper -(unit) triangular matrices.

        -

        Definition

        -

        Defined in the header triangular.hpp.

        -

        Type requirements

        - -

        Preconditions

        -
          -
        • e1 ().size1 () == e1 ().size2 ()
        • -
        • e1 ().size2 () == e2 ().size ()
        • -
        • e1 ().size () == e2 ().size1 ()
        • -
        • e2 ().size1 () == e2 ().size2 ()
        • -
        -

        Complexity

        -

        Quadratic depending from the size of the matrix expression.

        -

        Examples

        -
        -#include <boost/numeric/ublas/triangular.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    vector<double> v (3);
        -    for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) {
        -        for (unsigned j = 0; j <= i; ++ j)
        -            m (i, j) = 3 * i + j + 1;
        -        v (i) = i;
        -    }
        -
        -    std::cout << solve (m, v, lower_tag ()) << std::endl;
        -    std::cout << solve (v, m, lower_tag ()) << std::endl;
        -}
        -
        -

        Matrix Matrix Operations

        -

        Binary Operation Description

        -

        Description

        -

        The templated class matrix_matrix_binary<E1, E2, -F> describes a binary matrix operation.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        E1The type of the first matrix expression.
        E2The type of the second matrix expression.
        FThe type of the operation.
        -

        Model of

        -

        Matrix Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_expression<matrix_matrix_binary<E1, E2, F> -> .

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_matrix_binary (const expression1_type &e1, -const expression2_type &e2)Constructs a description of the expression.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value of the j-th element in the -i-th row.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the expression.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the expression.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the expression.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the expression.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed expression.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed expression.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed expression.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed expression.
        -

        Binary Operations

        -

        Prototypes

        -
        -template<class T1, class E1, class T2, class E2>
        -    struct matrix_matrix_binary_traits {
        -        typedef unknown_orientation_tag dispatch_category;
        -        typedef typename promote_traits<T1, T2>::promote_type promote_type;
        -        typedef matrix_matrix_binary<typename E1::const_closure_type,
        -                                     typename E2::const_closure_type,
        -                                     matrix_matrix_prod<T1, T2, promote_type> > expression_type;
        -        typedef expression_type result_type;
        -    };
        -
        -    template<class E1, class E2>
        -    typename matrix_matrix_binary_traits<typename E1::value_type, E1,
        -                                         typename E2::value_type, E2>::result_type
        -    prod (const matrix_expression<E1> &e1,
        -          const matrix_expression<E2> &e2,
        -          unknown_orientation_tag);
        -
        -    // Dispatcher
        -    template<class E1, class E2>
        -    typename matrix_matrix_binary_traits<typename E1::value_type, E1,
        -                                         typename E2::value_type, E2>::result_type
        -    prod (const matrix_expression<E1> &e1,
        -          const matrix_expression<E2> &e2);
        -
        -    template<class E1, class E2>
        -    typename matrix_matrix_binary_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
        -                                         typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
        -    prec_prod (const matrix_expression<E1> &e1,
        -               const matrix_expression<E2> &e2,
        -               unknown_orientation_tag);
        -
        -    // Dispatcher
        -    template<class E1, class E2>
        -    typename matrix_matrix_binary_traits<typename type_traits<typename E1::value_type>::precision_type, E1,
        -                                         typename type_traits<typename E2::value_type>::precision_type, E2>::result_type
        -    prec_prod (const matrix_expression<E1> &e1,
        -               const matrix_expression<E2> &e2);
        -
        -    template<class M, class E1, class E2>
        -    M
        -    prod (const matrix_expression<E1> &e1,
        -          const matrix_expression<E2> &e2);
        -
        -    template<class M, class E1, class E2>
        -    M
        -    prec_prod (const matrix_expression<E1> &e1,
        -               const matrix_expression<E2> &e2);
        -
        -

        Description

        -

        prod computes the product of the matrix -expressions. prec_prod computes the double precision -product of the matrix expressions.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -
          -
        • e1 ().size2 () == e2 ().size1 ()
        • -
        -

        Complexity

        -

        Cubic depending from the size of the matrix expression.

        -

        Examples

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m1 (3, 3), m2 (3, 3);
        -    for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)
        -        for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j)
        -            m1 (i, j) = m2 (i, j) = 3 * i + j;
        -
        -    std::cout << prod (m1, m2) << std::endl;
        -}
        -
        -

        Triangular Solvers

        -

        Prototypes

        -
        -template<class E1, class E2>
        -    struct matrix_matrix_solve_traits {
        -        typedef typename promote_traits<typename E1::value_type, typename E2::value_type>::promote_type promote_type;
        -        typedef matrix<promote_type> result_type;
        -    };
        -
        -    template<class E1, class E2>
        -    void inplace_solve (const matrix_expression<E1> &e1,
        -                        E2 &e2,
        -                        lower_tag,
        -                        matrix_tag);
        -    template<class E1, class E2>
        -    void inplace_solve (const matrix_expression<E1> &e1,
        -                        E2 &e2,
        -                        upper_tag,
        -                        matrix_tag);
        -    template<class E1, class E2>
        -    void inplace_solve (const matrix_expression<E1> &e1,
        -                        E2 &e2,
        -                        unit_lower_tag,
        -                        matrix_tag);
        -    template<class E1, class E2>
        -    void inplace_solve (const matrix_expression<E1> &e1,
        -                        E2 &e2,
        -                        unit_upper_tag,
        -                        matrix_tag);
        -
        -    template<class E1, class E2, class C>
        -    typename matrix_matrix_solve_traits<E1, E2>::result_type
        -    solve (const matrix_expression<E1> &e1,
        -           const matrix_expression<E2> &e2,
        -           C);
        -
        -

        Description

        -

        solve solves a linear equation for lower or upper -(unit) triangular matrices.

        -

        Definition

        -

        Defined in the header triangular.hpp.

        -

        Type requirements

        - -

        Preconditions

        -
          -
        • e1 ().size1 () == e1 ().size2 ()
        • -
        • e1 ().size2 () == e2 ().size1 ()
        • -
        -

        Complexity

        -

        Cubic depending from the size of the matrix expressions.

        -

        Examples

        -
        -#include <boost/numeric/ublas/triangular.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m1 (3, 3), m2 (3, 3);
        -    for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i)
        -        for (unsigned j = 0; j <= i; ++ j)
        -            m1 (i, j) = m2 (i, j) = 3 * i + j + 1;
        -
        -    std::cout << solve (m1, m2, lower_tag ()) << std::endl;
        -}
        -
        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/matrix_proxy.html b/doc/matrix_proxy.html deleted file mode 100644 index d4b420257..000000000 --- a/doc/matrix_proxy.html +++ /dev/null @@ -1,1428 +0,0 @@ - - - - - - - - - -Matrix Proxies - - -

        Matrix Proxies

        -
        -

        Matrix Row

        -

        Description

        -

        The templated class matrix_row<M> allows -addressing a row of a matrix.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/matrix_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i) {
        -        matrix_row<matrix<double> > mr (m, i);
        -        for (unsigned j = 0; j < mr.size (); ++ j)
        -            mr (j) = 3 * i + j;
        -        std::cout << mr << std::endl;
        -    }
        -}
        -
        -

        Definition

        -

        Defined in the header matrix_proxy.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        MThe type of matrix referenced.
        -

        Model of

        -

        Vector Expression -.

        -

        If the specified row falls outside that of the row index range -of the matrix, then the matrix_row is not a well -formed Vector Expression. That is, access to an element which is -outside of the matrix is undefined.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<matrix_row<M> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_row (matrix_type &data, size_type -i)Constructs a sub vector.
        size_type size () constReturns the size of the sub vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        reference operator () (size_type i)Returns a reference of the i-th element.
        matrix_row &operator = (const matrix_row -&mr)The assignment operator.
        matrix_row &assign_temporary (matrix_row -&mr)Assigns a temporary. May change the matrix row mr -.
        template<class AE>
        -matrix_row &operator = (const vector_expression<AE> -&ae)
        The extended assignment operator.
        template<class AE>
        -matrix_row &assign (const vector_expression<AE> -&ae)
        Assigns a vector expression to the sub vector. Left and right -hand side of the assignment should be independent.
        template<class AE>
        -matrix_row &operator += (const vector_expression<AE> -&ae)
        A computed assignment operator. Adds the vector expression to -the sub vector.
        template<class AE>
        -matrix_row &plus_assign (const vector_expression<AE> -&ae)
        Adds a vector expression to the sub vector. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -matrix_row &operator -= (const vector_expression<AE> -&ae)
        A computed assignment operator. Subtracts the vector expression -from the sub vector.
        template<class AE>
        -matrix_row &minus_assign (const vector_expression<AE> -&ae)
        Subtracts a vector expression from the sub vector. Left and -right hand side of the assignment should be independent.
        template<class AT>
        -matrix_row &operator *= (const AT &at)
        A computed assignment operator. Multiplies the sub vector with -a scalar.
        template<class AT>
        -matrix_row &operator /= (const AT &at)
        A computed assignment operator. Divides the sub vector through -a scalar.
        void swap (matrix_row &mr)Swaps the contents of the sub vectors.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the matrix_row.
        const_iterator end () constReturns a const_iterator pointing to the end of -the matrix_row.
        iterator begin ()Returns a iterator pointing to the beginning of -the matrix_row.
        iterator end ()Returns a iterator pointing to the end of the -matrix_row.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed matrix_row.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed matrix_row.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed matrix_row.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed matrix_row.
        -

        Projections

        -

        Description

        -

        The free row functions support the construction of -matrix rows.

        -

        Prototypes

        -
        
        -    template<class M>
        -    matrix_row<M> row (M &data, std::size_t i);
        -    template<class M>
        -    const matrix_row<const M> row (const M &data, std::size_t i);
        -
        -

        Definition

        -

        Defined in the header matrix_proxy.hpp.

        -

        Type requirements

        - -

        Complexity

        -

        Linear depending from the size of the row.

        -

        Examples

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/matrix_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i) {
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            row (m, i) (j) = 3 * i + j;
        -        std::cout << row (m, i) << std::endl;
        -    }
        -}
        -
        -

        Matrix Column

        -

        Description

        -

        The templated class matrix_column<M> allows -addressing a column of a matrix.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/matrix_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    for (unsigned j = 0; j < m.size2 (); ++ j) {
        -        matrix_column<matrix<double> > mc (m, j);
        -        for (unsigned i = 0; i < mc.size (); ++ i)
        -            mc (i) = 3 * i + j;
        -        std::cout << mc << std::endl;
        -    }
        -}
        -
        -

        Definition

        -

        Defined in the header matrix_proxy.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        MThe type of matrix referenced.
        -

        Model of

        -

        Vector Expression -.

        -

        If the specified column falls outside that of the column index -range of the matrix, then the matrix_column is not a -well formed Vector Expression. That is, access to an element which -is outside of the matrix is undefined.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<matrix_column<M> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_column (matrix_type &data, size_type -j)Constructs a sub vector.
        size_type size () constReturns the size of the sub vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        reference operator () (size_type i)Returns a reference of the i-th element.
        matrix_column &operator = (const matrix_column -&mc)The assignment operator.
        matrix_column &assign_temporary (matrix_column -&mc)Assigns a temporary. May change the matrix column -mc .
        template<class AE>
        -matrix_column &operator = (const vector_expression<AE> -&ae)
        The extended assignment operator.
        template<class AE>
        -matrix_column &assign (const vector_expression<AE> -&ae)
        Assigns a vector expression to the sub vector. Left and right -hand side of the assignment should be independent.
        template<class AE>
        -matrix_column &operator += (const vector_expression<AE> -&ae)
        A computed assignment operator. Adds the vector expression to -the sub vector.
        template<class AE>
        -matrix_column &plus_assign (const vector_expression<AE> -&ae)
        Adds a vector expression to the sub vector. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -matrix_column &operator -= (const vector_expression<AE> -&ae)
        A computed assignment operator. Subtracts the vector expression -from the sub vector.
        template<class AE>
        -matrix_column &minus_assign (const vector_expression<AE> -&ae)
        Subtracts a vector expression from the sub vector. Left and -right hand side of the assignment should be independent.
        template<class AT>
        -matrix_column &operator *= (const AT &at)
        A computed assignment operator. Multiplies the sub vector with -a scalar.
        template<class AT>
        -matrix_column &operator /= (const AT &at)
        A computed assignment operator. Divides the sub vector through -a scalar.
        void swap (matrix_column &mc)Swaps the contents of the sub vectors.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the matrix_column.
        const_iterator end () constReturns a const_iterator pointing to the end of -the matrix_column.
        iterator begin ()Returns a iterator pointing to the beginning of -the matrix_column.
        iterator end ()Returns a iterator pointing to the end of the -matrix_column.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed matrix_column.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed matrix_column.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed matrix_column.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed matrix_column.
        -

        Projections

        -

        Description

        -

        The free column functions support the construction -of matrix columns.

        -

        Prototypes

        -
        
        -    template<class M>
        -    matrix_column<M> column (M &data, std::size_t j);
        -    template<class M>
        -    const matrix_column<const M> column (const M &data, std::size_t j);
        -
        -

        Definition

        -

        Defined in the header matrix_proxy.hpp.

        -

        Type requirements

        - -

        Complexity

        -

        Linear depending from the size of the column.

        -

        Examples

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/matrix_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    for (unsigned j = 0; j < m.size2 (); ++ j) {
        -        for (unsigned i = 0; i < m.size1 (); ++ i)
        -            column (m, j) (i) = 3 * i + j;
        -        std::cout << column (m, j) << std::endl;
        -    }
        -}
        -
        -

        Vector Range

        -

        Description

        -

        The templated class matrix_vector_range<M> -allows addressing a sub vector of a matrix.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/matrix_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i)
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            m (i, j) = 3 * i + j;
        -
        -    matrix_vector_range<matrix<double> > mvr (m, range (0, 3), range (0, 3));
        -    std::cout << mvr << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix_proxy.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        MThe type of matrix referenced.
        -

        Model of

        -

        Vector Expression -.

        -

        If the specified ranges fall outside that of the index range of -the matrix, then the matrix_vector_range is not a well -formed Vector Expression. That is, access to an element which is -outside of the matrix is undefined.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<matrix_vector_range<M> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_vector_range (matrix_type &data,
        -const range &r1, const range &r2)
        Constructs a sub vector.
        size_type size () constReturns the size of the sub vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        reference operator () (size_type i)Returns a reference of the i-th element.
        matrix_vector_range &operator = (const -matrix_vector_range &mvr)The assignment operator.
        matrix_vector_range &assign_temporary -(matrix_vector_range &mvr)Assigns a temporary. May change the matrix vector range -mvr.
        template<class AE>
        -matrix_vector_range &operator = (const -vector_expression<AE> &ae)
        The extended assignment operator.
        template<class AE>
        -matrix_vector_range &assign (const vector_expression<AE> -&ae)
        Assigns a vector expression to the sub vector. Left and right -hand side of the assignment should be independent.
        template<class AE>
        -matrix_vector_range &operator += (const -vector_expression<AE> &ae)
        A computed assignment operator. Adds the vector expression to -the sub vector.
        template<class AE>
        -matrix_vector_range &plus_assign (const -vector_expression<AE> &ae)
        Adds a vector expression to the sub vector. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -matrix_vector_range &operator -= (const -vector_expression<AE> &ae)
        A computed assignment operator. Subtracts the vector expression -from the sub vector.
        template<class AE>
        -matrix_vector_range &minus_assign (const -vector_expression<AE> &ae)
        Subtracts a vector expression from the sub vector. Left and -right hand side of the assignment should be independent.
        template<class AT>
        -matrix_vector_range &operator *= (const AT &at)
        A computed assignment operator. Multiplies the sub vector with -a scalar.
        template<class AT>
        -matrix_vector_range &operator /= (const AT &at)
        A computed assignment operator. Divides the sub vector through -a scalar.
        void swap (matrix_vector_range &mvr)Swaps the contents of the sub vectors.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the matrix_vector_range.
        const_iterator end () constReturns a const_iterator pointing to the end of -the matrix_vector_range.
        iterator begin ()Returns a iterator pointing to the beginning of -the matrix_vector_range.
        iterator end ()Returns a iterator pointing to the end of the -matrix_vector_range.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the matrix_vector_range.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed matrix_vector_range.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed matrix_vector_range.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed matrix_vector_range.
        -

        Vector Slice

        -

        Description

        -

        The templated class matrix_vector_slice<M> -allows addressing a sliced sub vector of a matrix.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/matrix_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i)
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            m (i, j) = 3 * i + j;
        -
        -    matrix_vector_slice<matrix<double> > mvs (m, slice (0, 1, 3), slice (0, 1, 3));
        -    std::cout << mvs << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix_proxy.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        MThe type of matrix referenced.
        -

        Model of

        -

        Vector Expression -.

        -

        If the specified slices fall outside that of the index range of -the matrix, then the matrix_vector_slice is not a well -formed Vector Expression. That is, access to an element which is -outside of the matrix is undefined.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<matrix_vector_slice<M> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_vector_slice (matrix_type &data,
        -const slice &s1, const slice &s2)
        Constructs a sub vector.
        size_type size () constReturns the size of the sub vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        reference operator () (size_type i)Returns a reference of the i-th element.
        matrix_vector_slice &operator = (const -matrix_vector_slice &mvs)The assignment operator.
        matrix_vector_slice &assign_temporary -(matrix_vector_slice &mvs)Assigns a temporary. May change the matrix vector slice -vs.
        template<class AE>
        -matrix_vector_slice &operator = (const -vector_expression<AE> &ae)
        The extended assignment operator.
        template<class AE>
        -matrix_vector_slice &assign (const vector_expression<AE> -&ae)
        Assigns a vector expression to the sub vector. Left and right -hand side of the assignment should be independent.
        template<class AE>
        -matrix_vector_slice &operator += (const -vector_expression<AE> &ae)
        A computed assignment operator. Adds the vector expression to -the sub vector.
        template<class AE>
        -matrix_vector_slice &plus_assign (const -vector_expression<AE> &ae)
        Adds a vector expression to the sub vector. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -matrix_vector_slice &operator -= (const -vector_expression<AE> &ae)
        A computed assignment operator. Subtracts the vector expression -from the sub vector.
        template<class AE>
        -matrix_vector_slice &minus_assign (const -vector_expression<AE> &ae)
        Subtracts a vector expression from the sub vector. Left and -right hand side of the assignment should be independent.
        template<class AT>
        -matrix_vector_slice &operator *= (const AT &at)
        A computed assignment operator. Multiplies the sub vector with -a scalar.
        template<class AT>
        -matrix_vector_slice &operator /= (const AT &at)
        A computed assignment operator. Divides the sub vector through -a scalar.
        void swap (matrix_vector_slice &mvs)Swaps the contents of the sub vectors.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the matrix_vector_slice.
        const_iterator end () constReturns a const_iterator pointing to the end of -the matrix_vector_slice.
        iterator begin ()Returns a iterator pointing to the beginning of -the matrix_vector_slice.
        iterator end ()Returns a iterator pointing to the end of the -matrix_vector_slice.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed matrix_vector_slice.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed matrix_vector_slice.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed matrix_vector_slice.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed matrix_vector_slice.
        -

        Matrix Range

        -

        Description

        -

        The templated class matrix_range<M> allows -addressing a sub matrix of a matrix.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/matrix_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    matrix_range<matrix<double> > mr (m, range (0, 3), range (0, 3));
        -    for (unsigned i = 0; i < mr.size1 (); ++ i)
        -        for (unsigned j = 0; j < mr.size2 (); ++ j)
        -            mr (i, j) = 3 * i + j;
        -    std::cout << mr << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix_proxy.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        MThe type of matrix referenced.
        -

        Model of

        -

        Matrix Expression -.

        -

        If the specified ranges fall outside that of the index range of -the matrix, then the matrix_range is not a well formed -Matrix Expression. That is, access to an element which is outside -of the matrix is undefined.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_expression<matrix_range<M> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_range (matrix_type &data,
        -const range &r1, const range &r2)
        Constructs a sub matrix.
        size_type start1 () constReturns the index of the first row.
        size_type size1 () constReturns the number of rows.
        size_type start2 () constReturns the index of the first column.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value 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.
        matrix_range &operator = (const matrix_range -&mr)The assignment operator.
        matrix_range &assign_temporary (matrix_range -&mr)Assigns a temporary. May change the matrix range -mr .
        template<class AE>
        -matrix_range &operator = (const matrix_expression<AE> -&ae)
        The extended assignment operator.
        template<class AE>
        -matrix_range &assign (const matrix_expression<AE> -&ae)
        Assigns a matrix expression to the sub matrix. Left and right -hand side of the assignment should be independent.
        template<class AE>
        -matrix_range &operator += (const matrix_expression<AE> -&ae)
        A computed assignment operator. Adds the matrix expression to -the sub matrix.
        template<class AE>
        -matrix_range &plus_assign (const matrix_expression<AE> -&ae)
        Adds a matrix expression to the sub matrix. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -matrix_range &operator -= (const matrix_expression<AE> -&ae)
        A computed assignment operator. Subtracts the matrix expression -from the sub matrix.
        template<class AE>
        -matrix_range &minus_assign (const matrix_expression<AE> -&ae)
        Subtracts a matrix expression from the sub matrix. Left and -right hand side of the assignment should be independent.
        template<class AT>
        -matrix_range &operator *= (const AT &at)
        A computed assignment operator. Multiplies the sub matrix with -a scalar.
        template<class AT>
        -matrix_range &operator /= (const AT &at)
        A computed assignment operator. Divides the sub matrix through -a scalar.
        void swap (matrix_range &mr)Swaps the contents of the sub matrices.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the matrix_range.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the matrix_range.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the matrix_range.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -matrix_range.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the matrix_range.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the matrix_range.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the matrix_range.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -matrix_range.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed matrix_range.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed matrix_range.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed matrix_range.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed matrix_range.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed matrix_range.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed matrix_range.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed matrix_range.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -reversed the matrix_range.
        -

        Simple Projections

        -

        Description

        -

        The free subrange functions support the construction -of matrix ranges.

        -

        Prototypes

        -
        
        -    template<class M>
        -    matrix_range<M> subrange (M &data,
        -       M::size_type start1, M::size_type stop1, M::size_type start2, M::size_type, stop2);
        -    template<class M>
        -    const matrix_range<const M> subrange (const M &data,
        -       M::size_type start1, M::size_type stop1, M::size_type start2, M::size_type, stop2);
        -
        -

        Generic Projections

        -

        Description

        -

        The free project functions support the construction -of matrix ranges. Existing matrix_range's can be composed with further ranges. The resulting ranges are computed using this existing ranges' compose function.

        -

        Prototypes

        -
        
        -    template<class M>
        -    matrix_range<M> project (M &data, const range &r1, const range &r2);
        -    template<class M>
        -    const matrix_range<const M> project (const M &data, const range &r1, const range &r2);
        -    template<class M>
        -    matrix_range<M> project (matrix_range<M> &data, const range &r1, const range &r2);
        -    template<class M>
        -    const matrix_range<M> project (const matrix_range<M> &data, const range &r1, const range &r2);
        -
        -

        Definition

        -

        Defined in the header matrix_proxy.hpp.

        -

        Type requirements

        - -

        Complexity

        -

        Quadratic depending from the size of the ranges.

        -

        Examples

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/matrix_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i)
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            project (m, range (0, 3), range (0, 3)) (i, j) = 3 * i + j;
        -    std::cout << project (m, range (0, 3), range (0, 3)) << std::endl;
        -}
        -
        -

        Matrix Slice

        -

        Description

        -

        The templated class matrix_slice<M> allows -addressing a sliced sub matrix of a matrix.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/matrix_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    matrix_slice<matrix<double> > ms (m, slice (0, 1, 3), slice (0, 1, 3));
        -    for (unsigned i = 0; i < ms.size1 (); ++ i)
        -        for (unsigned j = 0; j < ms.size2 (); ++ j)
        -            ms (i, j) = 3 * i + j;
        -    std::cout << ms << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix_proxy.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        MThe type of matrix referenced.
        -

        Model of

        -

        Matrix Expression -.

        -

        If the specified slices fall outside that of the index range of -the matrix, then the matrix_slice is not a well formed -Matrix Expression. That is, access to an element which is outside -of the matrix is undefined.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_expression<matrix_slice<M> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        matrix_slice (matrix_type &data,
        -const slice &s1, const slice &s2)
        Constructs a sub matrix.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value 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.
        matrix_slice &operator = (const matrix_slice -&ms)The assignment operator.
        matrix_slice &assign_temporary (matrix_slice -&ms)Assigns a temporary. May change the matrix slice -ms .
        template<class AE>
        -matrix_slice &operator = (const matrix_expression<AE> -&ae)
        The extended assignment operator.
        template<class AE>
        -matrix_slice &assign (const matrix_expression<AE> -&ae)
        Assigns a matrix expression to the sub matrix. Left and right -hand side of the assignment should be independent.
        template<class AE>
        -matrix_slice &operator += (const matrix_expression<AE> -&ae)
        A computed assignment operator. Adds the matrix expression to -the sub matrix.
        template<class AE>
        -matrix_slice &plus_assign (const matrix_expression<AE> -&ae)
        Adds a matrix expression to the sub matrix. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -matrix_slice &operator -= (const matrix_expression<AE> -&ae)
        A computed assignment operator. Subtracts the matrix expression -from the sub matrix.
        template<class AE>
        -matrix_slice &minus_assign (const matrix_expression<AE> -&ae)
        Subtracts a matrix expression from the sub matrix. Left and -right hand side of the assignment should be independent.
        template<class AT>
        -matrix_slice &operator *= (const AT &at)
        A computed assignment operator. Multiplies the sub matrix with -a scalar.
        template<class AT>
        -matrix_slice &operator /= (const AT &at)
        A computed assignment operator. Multiplies the sub matrix -through a scalar.
        void swap (matrix_slice &ms)Swaps the contents of the sub matrices.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the matrix_slice.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the matrix_slice.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the matrix_slice.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -matrix_slice.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the matrix_slice.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the matrix_slice.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the matrix_slice.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -matrix_slice.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed matrix_slice.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed matrix_slice.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed matrix_slice.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed matrix_slice.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed matrix_slice.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed matrix_slice.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed matrix_slice.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed matrix_slice.
        -

        Simple Projections

        -

        Description

        -

        The free subslice functions support the construction -of matrix slices.

        -

        Prototypes

        -
        
        -    template<class M>
        -    matrix_slice<M> subslice (M &data,
        -       M::size_type start1, M::difference_type stride1, M::size_type size1,
        -       M::size_type start2, M::difference_type stride2, M::size_type size2);
        -    template<class M>
        -    const matrix_slice<const M> subslice (const M &data,
        -       M::size_type start1, M::difference_type stride1, M::size_type size1,
        -       M::size_type start2, M::difference_type stride2, M::size_type size2);
        -
        -

        Generic Projections

        -

        Description

        -

        The free project functions support the construction -of matrix slices. Existing matrix_slice's can be composed with further ranges or slices. The resulting slices are computed using this existing slices' compose function.

        -

        Prototypes

        -
        
        -    template<class M>
        -    matrix_slice<M> project (M &data, const slice &s1, const slice &s2);
        -    template<class M>
        -    const matrix_slice<const M> project (const M &data, const slice &s1, const slice &s2);
        -    template<class M>
        -    matrix_slice<M> project (matrix_slice<M> &data, const range &r1, const range &r2);
        -    template<class M>
        -    const matrix_slice<M> project (const matrix_slice<M> &data, const range &r1, const range &r2);
        -    template<class M>
        -    matrix_slice<M> project (matrix_slice<M> &data, const slice &s1, const slice &s2);
        -    template<class M>
        -    const matrix_slice<M> project (const matrix_slice<M> &data, const slice &s1, const slice &s2);
        -
        -

        Definition

        -

        Defined in the header matrix_proxy.hpp.

        -

        Type requirements

        - -

        Complexity

        -

        Quadratic depending from the size of the slices.

        -

        Examples

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/matrix_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    matrix<double> m (3, 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i)
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            project (m, slice (0, 1, 3), slice (0, 1, 3)) (i, j) = 3 * i + j;
        -    std::cout << project (m, slice (0, 1, 3), slice (0, 1, 3)) << std::endl;
        -}
        -
        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/matrix_sparse.html b/doc/matrix_sparse.html deleted file mode 100644 index fb77de468..000000000 --- a/doc/matrix_sparse.html +++ /dev/null @@ -1,983 +0,0 @@ - - - - - - - - - -Sparse Matrix - - -

        Sparse Matricies

        -
        -

        Mapped Matrix

        -

        Description

        -

        The templated class mapped_matrix<T, F, A> is -the base container adaptor for sparse matricies using element maps. -For a (m xn)-dimensional sparse matrix and 0 <= i < m, -0 <= j < n the non-zero elements -mi, j are mapped via (i x n + -j) for row major orientation or via (i + j x m) for -column major orientation to consecutive elements of the associative -container, i.e. for elements k = -mi1 -,j1and k + 1 = -mi2 -,j2of the container holds -i1 < -i2 or (i1 -= i2 and -j1 < -j2) with row major orientation or -j1 < -j2 or (j1 -= j2 and -i1 < -i2) with column major -orientation.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix_sparse.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    mapped_matrix<double> m (3, 3, 3 * 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i)
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            m (i, j) = 3 * i + j;
        -    std::cout << m << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix_sparse.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the mapped matrix.
        FFunctor describing the storage organization. [1]row_major
        AThe type of the adapted array. [2]map_std<std::size_t, T>
        -

        Model of

        -

        Matrix .

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_container<mapped_matrix<T, F, A> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        mapped_matrix ()Allocates a mapped_matrix that holds at most zero -rows of zero elements.
        mapped_matrix (size_type size1, size_type2, size_type non_zeros = 0)Allocates a mapped_matrix that holds at most -size1 rows of size2 elements.
        mapped_matrix (const mapped_matrix &m)The copy constructor.
        template<class AE>
        -mapped_matrix (size_type non_zeros, const -matrix_expression<AE> &ae)
        The extended copy constructor.
        void resize (size_type size1, size_type size2, bool preserve = true)Reallocates a mapped_matrix to hold at most -size1 rows of size2 elements. The -existing elements of the mapped_matrix are preseved -when specified.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value 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.
        mapped_matrix &operator = (const mapped_matrix -&m)The assignment operator.
        mapped_matrix &assign_temporary (mapped_matrix -&m)Assigns a temporary. May change the mapped matrix -m .
        template<class AE>
        -mapped_matrix &operator = (const matrix_expression<AE> -&ae)
        The extended assignment operator.
        template<class AE>
        -mapped_matrix &assign (const matrix_expression<AE> -&ae)
        Assigns a matrix expression to the mapped matrix. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -mapped_matrix &operator += (const matrix_expression<AE> -&ae)
        A computed assignment operator. Adds the matrix expression to -the mapped matrix.
        template<class AE>
        -mapped_matrix &plus_assign (const matrix_expression<AE> -&ae)
        Adds a matrix expression to the mapped matrix. Left and right -hand side of the assignment should be independent.
        template<class AE>
        -mapped_matrix &operator -= (const matrix_expression<AE> -&ae)
        A computed assignment operator. Subtracts the matrix expression -from the mapped matrix.
        template<class AE>
        -mapped_matrix &minus_assign (const matrix_expression<AE> -&ae)
        Subtracts a matrix expression from the mapped matrix. Left and -right hand side of the assignment should be independent.
        template<class AT>
        -mapped_matrix &operator *= (const AT &at)
        A computed assignment operator. Multiplies the mapped matrix -with a scalar.
        template<class AT>
        -mapped_matrix &operator /= (const AT &at)
        A computed assignment operator. Divides the mapped matrix -through a scalar.
        void swap (mapped_matrix &m)Swaps the contents of the mapped matrices.
        true_refrence insert_element (size_type i, size_type j, const_reference -t)Inserts the value t at the j-th -element of the i-th row. Duplicates elements are not allowed.
        void erase_element (size_type i, size_type j)Erases the value at the j-th element of the -i-th row.
        void clear ()Clears the mapped matrix.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the mapped_matrix.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the mapped_matrix.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the mapped_matrix.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -mapped_matrix.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the mapped_matrix.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the mapped_matrix.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the mapped_matrix.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -mapped_matrix.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed mapped_matrix.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed mapped_matrix.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed mapped_matrix.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed mapped_matrix.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed mapped_matrix.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed mapped_matrix.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed mapped_matrix.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed mapped_matrix.
        -

        Notes

        -

        [1] Supported -parameters for the storage organization are row_major -and column_major.

        -

        [2] Supported -parameters for the adapted array are -map_array<std::size_t, T> and -map_std<std::size_t, T>. The latter is -equivalent to std::map<std::size_t, T>.

        -

        Compressed Matrix

        -

        Description

        -

        The templated class compressed_matrix<T, F, IB, IA, -TA> is the base container adaptor for compressed -matrices. For a (m x n )-dimensional compressed matrix and -0 <= i < m, 0 <= j < n the non-zero -elements mi, j are mapped via (i x -n + j) for row major orientation or via (i + j x m) -for column major orientation to consecutive elements of the index -and value containers, i.e. for elements k = -mi1 -,j1and k + 1 = -mi2 -,j2of the container holds -i1 < -i2 or (i1 -= i2 and -j1 < -j2) with row major orientation or -j1 < -j2 or (j1 -= j2 and -i1 < -i2) with column major -orientation.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix_sparse.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    compressed_matrix<double> m (3, 3, 3 * 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i)
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            m (i, j) = 3 * i + j;
        -    std::cout << m << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix_sparse.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the compressed matrix.
        FFunctor describing the storage organization. [1]row_major
        IBThe index base of the compressed vector. [2]0
        IAThe type of the adapted array for indices. [3]unbounded_array<std::size_t>
        TAThe type of the adapted array for values. [3]unbounded_array<T>
        -

        Model of

        -

        Matrix .

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_container<compressed_matrix<T, F, IB, IA, -TA> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        compressed_matrix ()Allocates a compressed_matrix that holds at most -zero rows of zero elements.
        compressed_matrix (size_type size1, size_type2, size_type non_zeros = 0)Allocates a compressed_matrix that holds at most -size1 rows of size2 elements.
        compressed_matrix (const compressed_matrix -&m)The copy constructor.
        template<class AE>
        -compressed_matrix (size_type non_zeros, const -matrix_expression<AE> &ae)
        The extended copy constructor.
        void resize (size_type size1, size_type size2, bool preserve = true)Reallocates a compressed_matrix to hold at most -size1 rows of size2 elements. The -existing elements of the compressed_matrix are -preseved when specified.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value 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.
        compressed_matrix &operator = (const -compressed_matrix &m)The assignment operator.
        compressed_matrix &assign_temporary -(compressed_matrix &m)Assigns a temporary. May change the compressed matrix -m.
        template<class AE>
        -compressed_matrix &operator = (const -matrix_expression<AE> &ae)
        The extended assignment operator.
        template<class AE>
        -compressed_matrix &assign (const matrix_expression<AE> -&ae)
        Assigns a matrix expression to the compressed matrix. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -compressed_matrix &operator += (const -matrix_expression<AE> &ae)
        A computed assignment operator. Adds the matrix expression to -the compressed matrix.
        template<class AE>
        -compressed_matrix &plus_assign (const -matrix_expression<AE> &ae)
        Adds a matrix expression to the compressed matrix. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -compressed_matrix &operator -= (const -matrix_expression<AE> &ae)
        A computed assignment operator. Subtracts the matrix expression -from the compressed matrix.
        template<class AE>
        -compressed_matrix &minus_assign (const -matrix_expression<AE> &ae)
        Subtracts a matrix expression from the compressed matrix. Left -and right hand side of the assignment should be independent.
        template<class AT>
        -compressed_matrix &operator *= (const AT &at)
        A computed assignment operator. Multiplies the compressed -matrix with a scalar.
        template<class AT>
        -compressed_matrix &operator /= (const AT &at)
        A computed assignment operator. Divides the compressed matrix -through a scalar.
        void swap (compressed_matrix &m)Swaps the contents of the compressed matrices.
        true_reference insert_element (size_type i, size_type j, const_reference -t)Inserts the value t at the j-th -element of the i-th row. Duplicates elements are not allowed.
        void erase_element (size_type i, size_type j)Erases the value at the j-th element of the -i-th row.
        void clear ()Clears the compressed matrix.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the compressed_matrix.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the compressed_matrix.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the compressed_matrix.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -compressed_matrix.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the compressed_matrix.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the compressed_matrix.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the compressed_matrix.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -compressed_matrix.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed compressed_matrix.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed compressed_matrix.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed compressed_matrix.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed compressed_matrix.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed compressed_matrix.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed compressed_matrix.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed compressed_matrix.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed compressed_matrix.
        -

        Notes

        -

        [1] -Supported parameters for the storage organization are -row_major and column_major.

        -

        [2] -Supported parameters for the index base are 0 and -1 at least.

        -

        [3] -Supported parameters for the adapted array are -unbounded_array<> , -bounded_array<> and -std::vector<> .

        -

        Coordinate Matrix

        -

        Description

        -

        The templated class coordinate_matrix<T, F, IB, IA, -TA> is the base container adaptor for compressed -matrices. For a (m x n )-dimensional sorted coordinate -matrix and 0 <= i < m, 0 <= j < n the -non-zero elements mi, j are mapped via -(i x n + j) for row major orientation or via (i + j x -m) for column major orientation to consecutive elements of the -index and value containers, i.e. for elements k = -mi1 -,j1and k + 1 = -mi2 -,j2of the container holds -i1 < -i2 or (i1 -= i2 and -j1 < -j2) with row major orientation or -j1 < -j2 or (j1 -= j2 and -i1 < -i2) with column major -orientation.

        -

        Example

        -
        -#include <boost/numeric/ublas/matrix_sparse.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    coordinate_matrix<double> m (3, 3, 3 * 3);
        -    for (unsigned i = 0; i < m.size1 (); ++ i)
        -        for (unsigned j = 0; j < m.size2 (); ++ j)
        -            m (i, j) = 3 * i + j;
        -    std::cout << m << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header matrix_sparse.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the coordinate matrix.
        FFunctor describing the storage organization. [1]row_major
        IBThe index base of the coordinate vector. [2]0
        IAThe type of the adapted array for indices. [3]unbounded_array<std::size_t>
        TAThe type of the adapted array for values. [3]unbounded_array<T>
        -

        Model of

        -

        Matrix .

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_container<coordinate_matrix<T, F, IB, IA, -TA> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        coordinate_matrix ()Allocates a coordinate_matrix that holds at most -zero rows of zero elements.
        coordinate_matrix (size_type size1, size_type2, size_type non_zeros = 0)Allocates a coordinate_matrix that holds at most -size1 rows of size2 elements.
        coordinate_matrix (const coordinate_matrix -&m)The copy constructor.
        template<class AE>
        -coordinate_matrix (size_type non_zeros, const -matrix_expression<AE> &ae)
        The extended copy constructor.
        void resize (size_type size1, size_type size2, bool preserve = true)Reallocates a coordinate_matrix to hold at most -size1 rows of size2 elements. The -existing elements of the coordinate_matrix are -preseved when specified.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value 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.
        coordinate_matrix &operator = (const -coordinate_matrix &m)The assignment operator.
        coordinate_matrix &assign_temporary -(coordinate_matrix &m)Assigns a temporary. May change the coordinate matrix -m.
        template<class AE>
        -coordinate_matrix &operator = (const -matrix_expression<AE> &ae)
        The extended assignment operator.
        template<class AE>
        -coordinate_matrix &assign (const matrix_expression<AE> -&ae)
        Assigns a matrix expression to the coordinate matrix. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -coordinate_matrix &operator += (const -matrix_expression<AE> &ae)
        A computed assignment operator. Adds the matrix expression to -the coordinate matrix.
        template<class AE>
        -coordinate_matrix &plus_assign (const -matrix_expression<AE> &ae)
        Adds a matrix expression to the coordinate matrix. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -coordinate_matrix &operator -= (const -matrix_expression<AE> &ae)
        A computed assignment operator. Subtracts the matrix expression -from the coordinate matrix.
        template<class AE>
        -coordinate_matrix &minus_assign (const -matrix_expression<AE> &ae)
        Subtracts a matrix expression from the coordinate matrix. Left -and right hand side of the assignment should be independent.
        template<class AT>
        -coordinate_matrix &operator *= (const AT &at)
        A computed assignment operator. Multiplies the coordinate -matrix with a scalar.
        template<class AT>
        -coordinate_matrix &operator /= (const AT &at)
        A computed assignment operator. Divides the coordinate matrix -through a scalar.
        void swap (coordinate_matrix &m)Swaps the contents of the coordinate matrices.
        true_reference insert_element (size_type i, size_type j, const_reference -t)Inserts the value t at the j-th -element of the i-th row. Duplicates elements are not allowed.
        void append_element (size_type i, size_type j, const_reference t)Appends the value t at the j-th element of the i-th row. -Duplicate elements can be appended to a coordinate_matrix. They are merged into a single -arithmetically summed element by the sort function.
        void erase_element (size_type i, size_type j)Erases the value at the j-th element of the -i-th row.
        void clear ()Clears the coordinate matrix.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the coordinate_matrix.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the coordinate_matrix.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the coordinate_matrix.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -coordinate_matrix.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the coordinate_matrix.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the coordinate_matrix.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the coordinate_matrix.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -coordinate_matrix.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed coordinate_matrix.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed coordinate_matrix.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed coordinate_matrix.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed coordinate_matrix.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed coordinate_matrix.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed coordinate_matrix.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed coordinate_matrix.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed coordinate_matrix.
        -

        Notes

        -

        [1] -Supported parameters for the storage organization are -row_major and column_major.

        -

        [2] -Supported parameters for the index base are 0 and -1 at least.

        -

        [3] -Supported parameters for the adapted array are -unbounded_array<> , -bounded_array<> and -std::vector<> .

        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/operations_overview.html b/doc/operations_overview.html deleted file mode 100644 index 442048e98..000000000 --- a/doc/operations_overview.html +++ /dev/null @@ -1,277 +0,0 @@ - - - - - - - - - - -uBLAS operations overview - - -

        Overview of Tensor, Matrix and Vector Operations

        -
        - -
        -
        Contents:
        -
        Basic Linear Algebra
        -
        Advanced Functions
        -
        Submatrices, Subvectors
        -
        Speed Improvements
        -
        - -

        Definitions

        - - - - - - - - - - - - - - - - -
        X, Y, Z are tensors
        A, B, C are matrices
        u, v, ware vectors
        i, j, kare integer values
        t, t1, t2are scalar values
        r, r1, r2are ranges, e.g. range(0, 3)
        s, s1, s2are slices, e.g. slice(0, 1, 3)
        - -

        Basic Linear Algebra

        - -

        standard operations: addition, subtraction, multiplication by a -scalar

        -
        
        -X = Y + Z; X = Y - Z; X = -Y;
        -C = A + B; C = A - B; C = -A;
        -w = u + v; w = u - v; w = -u;
        -X = t * Y; Y = X * t; X = Y / t;
        -C = t * A; C = A * t; C = A / t;
        -w = t * u; w = u * t; w = u / t;
        -
        - -

        computed assignments

        -
        
        -X += Y; X -= Y; 
        -C += A; C -= A; 
        -w += u; w -= u; 
        -X *= t; X /= t; 
        -C *= t; C /= t; 
        -w *= t; w /= t;
        -
        - -

        inner, outer and other products

        -
        
        -t = inner_prod(u, v);
        -C = outer_prod(u, v);
        -w = prod(A, u); w = prod(u, A); w = prec_prod(A, u); w = prec_prod(u, A);
        -C = prod(A, B); C = prec_prod(A, B);
        -w = element_prod(u, v); w = element_div(u, v);
        -C = element_prod(A, B); C = element_div(A, B);
        -
        - -

        tensor products

        -
        
        -Z = prod(X, v, t);
        -Z = prod(X, A, t);
        -Z = prod(X, Y, p);
        -Z = prod(X, Y, pa, pb);
        -t = inner_prod(X, Y);
        -Z = outer_prod(X, Y);
        -
        - -

        transformations

        -
        
        -w = conj(u); w = real(u); w = imag(u);
        -C = trans(A); C = conj(A); C = herm(A); C = real(A); C = imag(A);
        -Z = trans(X); Z = conj(X); Z = real(X); Z = imag(X);
        -
        - - -

        Advanced functions

        - -

        norms

        - -
        
        -t = norm_inf(v); i = index_norm_inf(v);
        -t = norm_1(v);   t = norm_2(v);
        -t = norm_2_square(v);
        -t = norm_inf(A); i = index_norm_inf(A);
        -t = norm_1(A);   t = norm_frobenius(A); 
        -t = norm(X);
        -
        - -

        products

        - -
        
        -axpy_prod(A, u, w, true);  // w = A * u
        -axpy_prod(A, u, w, false); // w += A * u
        -axpy_prod(u, A, w, true);  // w = trans(A) * u
        -axpy_prod(u, A, w, false); // w += trans(A) * u
        -axpy_prod(A, B, C, true);  // C = A * B
        -axpy_prod(A, B, C, false); // C += A * B
        -
        -

        Note: The last argument (bool init) of -axpy_prod is optional. Currently it defaults to -true, but this may change in the future. Setting the -init to true is equivalent to calling -w.clear() before axpy_prod. -There are some specialisation for products of compressed matrices that give a -large speed up compared to prod.

        -
        
        -w = block_prod<matrix_type, 64> (A, u); // w = A * u
        -w = block_prod<matrix_type, 64> (u, A); // w = trans(A) * u
        -C = block_prod<matrix_type, 64> (A, B); // C = A * B
        -
        -

        Note: The blocksize can be any integer. However, the -actual speed depends very significantly on the combination of blocksize, -CPU and compiler. The function block_prod is designed -for large dense matrices.

        -

        rank-k updates

        -
        
        -opb_prod(A, B, C, true);  // C = A * B
        -opb_prod(A, B, C, false); // C += A * B
        -
        -

        Note: The last argument (bool init) of -opb_prod is optional. Currently it defaults to -true, but this may change in the future. This function -may give a speedup if A has less columns than rows, -because the product is computed as a sum of outer products.

        - -

        Submatrices, Subvectors

        -

        Accessing submatrices and subvectors via proxies using project functions:

        -
        
        -w = project(u, r);         // the subvector of u specifed by the index range r
        -w = project(u, s);         // the subvector of u specifed by the index slice s
        -C = project(A, r1, r2);    // the submatrix of A specified by the two index ranges r1 and r2
        -C = project(A, s1, s2);    // the submatrix of A specified by the two index slices s1 and s2
        -w = row(A, i); w = column(A, j);    // a row or column of matrix as a vector
        -
        -

        Assigning to submatrices and subvectors via proxies using project functions:

        -
        
        -project(u, r) = w;         // assign the subvector of u specifed by the index range r
        -project(u, s) = w;         // assign the subvector of u specifed by the index slice s
        -project(A, r1, r2) = C;    // assign the submatrix of A specified by the two index ranges r1 and r2
        -project(A, s1, s2) = C;    // assign the submatrix of A specified by the two index slices s1 and s2
        -row(A, i) = w; column(A, j) = w;    // a row or column of matrix as a vector
        -
        -

        Note: A range r = range(start, stop) -contains all indices i with start <= i < -stop. A slice is something more general. The slice -s = slice(start, stride, size) contains the indices -start, start+stride, ..., start+(size-1)*stride. The -stride can be 0 or negative! If start >= stop for a range -or size == 0 for a slice then it contains no elements.

        -

        Sub-ranges and sub-slices of vectors and matrices can be created directly with the subrange and sublice functions:

        -
        
        -w = subrange(u, 0, 2);         // the 2 element subvector of u
        -w = subslice(u, 0, 1, 2);      // the 2 element subvector of u
        -C = subrange(A, 0,2, 0,3);     // the 2x3 element submatrix of A
        -C = subslice(A, 0,1,2, 0,1,3); // the 2x3 element submatrix of A
        -subrange(u, 0, 2) = w;         // assign the 2 element subvector of u
        -subslice(u, 0, 1, 2) = w;      // assign the 2 element subvector of u
        -subrange(A, 0,2, 0,3) = C;     // assign the 2x3 element submatrix of A
        -subrange(A, 0,1,2, 0,1,3) = C; // assigne the 2x3 element submatrix of A
        -
        -

        There are to more ways to access some matrix elements as a -vector:

        -
        matrix_vector_range<matrix_type> (A, r1, r2);
        -matrix_vector_slice<matrix_type> (A, s1, s2);
        -
        -

        Note: These matrix proxies take a sequence of elements -of a matrix and allow you to access these as a vector. In -particular matrix_vector_slice can do this in a very -general way. matrix_vector_range is less useful as the -elements must lie along a diagonal.

        -

        Example: To access the first two elements of a sub -column of a matrix we access the row with a slice with stride 1 and -the column with a slice with stride 0 thus:
        -matrix_vector_slice<matrix_type> (A, slice(0,1,2), -slice(0,0,2)); -

        - -

        Speed improvements

        -

        Matrix / Vector assignment

        -

        If you know for sure that the left hand expression and the right -hand expression have no common storage, then assignment has -no aliasing. A more efficient assignment can be specified -in this case:

        -
        noalias(C) = prod(A, B);
        -
        -

        This avoids the creation of a temporary matrix that is required in a normal assignment. -'noalias' assignment requires that the left and right hand side be size conformant.

        - -

        Sparse element access

        -

        The matrix element access function A(i1,i2) or the equivalent vector -element access functions (v(i) or v[i]) usually create 'sparse element proxies' -when applied to a sparse matrix or vector. These proxies allow access to elements -without having to worry about nasty C++ issues where references are invalidated.

        -

        These 'sparse element proxies' can be implemented more efficiently when applied to const -objects. -Sadly in C++ there is no way to distinguish between an element access on the left and right hand side of -an assignment. Most often elements on the right hand side will not be changed and therefore it would -be better to use the const proxies. We can do this by making the matrix or vector -const before accessing it's elements. For example:

        -
        value = const_cast<const VEC>(v)[i];   // VEC is the type of V
        -
        -

        If more then one element needs to be accessed const_iterator's should be used -in preference to iterator's for the same reason. For the more daring 'sparse element proxies' -can be completely turned off in uBLAS by defining the configuration macro BOOST_UBLAS_NO_ELEMENT_PROXIES. -

        - - -

        Controlling the complexity of nested products

        - -

        What is the complexity (the number of add and multiply operations) required to compute the following? -

        -
        - R = prod(A, prod(B,C)); 
        -
        -

        Firstly the complexity depends on matrix size. Also since prod is transitive (not commutative) -the bracket order affects the complexity. -

        -

        uBLAS evaluates expressions without matrix or vector temporaries and honours -the bracketing structure. However avoiding temporaries for nested product unnecessarly increases the complexity. -Conversly by explictly using temporary matrices the complexity of a nested product can be reduced. -

        -

        uBLAS provides 3 alternative syntaxes for this purpose: -

        -
        - temp_type T = prod(B,C); R = prod(A,T);   // Preferable if T is preallocated
        -
        -
        - prod(A, temp_type(prod(B,C));
        -
        -
        - prod(A, prod<temp_type>(B,C));
        -
        -

        The 'temp_type' is important. Given A,B,C are all of the same type. Say -matrix<float>, the choice is easy. However if the value_type is mixed (int with float or double) -or the matrix type is mixed (sparse with symmetric) the best solution is not so obvious. It is up to you! It -depends on numerical properties of A and the result of the prod(B,C). -

        - -
        -

        Copyright (©) 2000-2007 Joerg Walter, Mathias Koch, Gunter -Winkler, Michael Stevens
        - 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 - ). -

        - - - diff --git a/doc/options.html b/doc/options.html deleted file mode 100644 index 2b9e6f231..000000000 --- a/doc/options.html +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - - - - - -Boost Basic Linear Algebra - Configuration Options - - -

        logoBoost Basic Linear Algebra - Configuration Options

        -
        - - - -

        NDEBUG

        - -

        Make sure you define NDEBUG The only way uBLAS -knows you want a release configuration is to check if you have defined -NDEBUG. If you don't it assumes you want a debug configuration and -adds a lot of very useful runtime check. However these are very slow! -

        - - -

        BOOST_UBLAS_MOVE_SEMANTICS

        - -

        The patch and description was provided by Nasos Iliopoulos.

        - -

        An immediate effect of this option is the elimination of the need -for noalias in types vector<T> and matrix<T>, -when assigned to the same type. This option doesn't have an effect on -bounded and c types. Although it is rare, not all compilers support copy -elision (that allows for move semantics), so a test must be performed to -make sure that there is a benefit when it is enabled. A small -demonstration and test can be found in -test_move_semantics.cpp

        - -

        -In the test -example two tests are defined, one for vectors and one for -matrices. The aim of this example is to print the pointers of the -storage of each of the containers, before and after the assignment to -a temporary object. When move semantics are enabled, the -vector<T> and matrix<T> storage is moved -from the temporary and no copy is performed. -

        - -

        -If move semantics are supported by your compiler you will get an output like the following: -

        -
        -matrix<double> --------------------------------------------------------------------
        -Temporary pointer r: 0x94790c0
        -Pointer (must be equal to temp. pointer if move semantics are enabled) : 0x94790c0
        -
        - -

        Notes:

        -
          -
        • It should be no surprise to see matrices and vectors been passed -by VALUE, the compiler takes care and either moves (if the underlying -code does not modify the object), or copies (if the underlying code -modifies the object). -
        • -
        • There might be some space for some improvements (like clearing the -data, before swaping) -
        • -
        • Move semantics don't eliminate temporaries. They rather move their -storage around so no copies are performed. -
        • -
        • MSVC does no implement Named Return Value Optimization in debug -mode. So if you build in debug with this compiler you might get different behaviour than a release build. -
        • -
        • Enabling move semantics is done via #define BOOST_UBLAS_MOVE_SEMANTICS. -
        • -
        • There is plenty of room for optimizations when c++0x standard is -out, taking advantage of rvalue references. (I have a sweet vector -implementation using that). -
        • -
        • If you enable move semantics and your compiler does not support -them, the operation will just be as passing by const reference. -
        • -
        - -

        Interesting links

        - - -

        BOOST_UBLAS_CHECK_ENABLE

        - -

        When BOOST_UBLAS_CHECK_ENABLE is defined then all index and -parameter checks are enabled. This is enabled in debug mode and -disabled in release mode. -

        - -

        BOOST_UBLAS_TYPE_CHECK

        - -

        When BOOST_UBLAS_TYPE_CHECK is enabled then all possibly expensive -structure checks are enabled. If this is not desireable then use -#define BOOST_UBLAS_TYPE_CHECK 0 before including any uBLAS -header. The define BOOST_UBLAS_TYPE_CHECK_EPSILON can be used to -control the acceptable tolerance, see -detail/matrix_assign.hpp for implementation details of this -check. -

        - -

        BOOST_UBLAS_USE_LONG_DOUBLE

        - -

        Enable uBLAS expressions that involve containers of 'long double'

        - -

        BOOST_UBLAS_USE_INTERVAL

        - -

        Enable uBLAS expressions that involve containers of 'boost::numeric::interval' types

        - -

        Configuring uBLAS with Macros

        - -

        Many macro's appear in ublas/config.hpp and elsewhere. Hopefully in the future some of these will disappear! -They fall into 4 groups: -

        -
          -
        • Automatically set by 'boost/numeric/ublas/config.hpp' based on -NDEBUG. Makes the distinction between debug (safe) and release (fast) -mode. Similar to STLport -
            -
          • Release mode (NDEBUG defined) -
              -
            • BOOST_UBLAS_INLINE Compiler dependant definition to control -function inlining.
            • BOOST_UBLAS_USE_FAST_SAME
            -
          • Debug mode -
              -
            • BOOST_UBLAS_CHECK_ENABLE Enable checking of indexs, iterators -and parameters. Prevents out of bound access etc.
            • -BOOST_UBLAS_TYPE_CHECK Enable additional checks for the results of -expressions using non dense types. Picks up runtime error such as the -assignment of a numerically non-symmetric matrix to -symmertic_matrix. Use #define BOOST_UBLAS_TYPE_CHECK 0 to -disable expensive numeric type checks. (Note: "structure check" -would be a much better name.)
            • -BOOST_UBLAS_TYPE_CHECK_EPSILON default: sqrt(epsilon), controls how -large the difference between the expected result and the computed -result may become. Increase this value if you are going to use near -singular or badly scaled matrices. Please, refer to -detail/matrix_assign.hpp for implementation of these type -checks.
          -
        • -
        • Automatically set by 'boost/numeric/ublas/config.hpp' based on -compiler and boost/config.hpp macro's. Augments the compiler -deficiency workarounds already supplied by boost/config.hpp -
            -
          • BOOST_UBLAS_NO_NESTED_CLASS_RELATION A particularly nasty -problem with VC7.1 Requires that uBLAS and the user use begin(it) -rather then it.begin()
          • BOOST_UBLAS_NO_SMART_PROXIES -Disable the automatic propagation of 'constantness' to -proxies. Smart proxies automatically determine if the underling -container they reference is constant or not. They adjust there -definition of iterators and container access to reflect this -constantness.
          -
        • -
        • For use by uBLAS authors to test implementation methods. Preset -in config.hpp -
            -
          • BOOST_UBLAS_USE_INVARIANT_HOISTING
          • -BOOST_UBLAS_USE_INDEXING
          • BOOST_UBLAS_USE_INDEXED_ITERATOR -
          • BOOST_UBLAS_NON_CONFORMANT_PROXIES Gappy containers may -be non-conformant, that is contain elements at different -indices. Assigning between proxies (vector ranges for example) of -these containers is difficult as the LHS may need insert new -elements. This is slow.
          • BOOST_UBLAS_USE_DUFF_DEVICE -Near useless on all platforms (see GCC's -funroll-loops) - -
          -
        • -
        • User options. Can be predefined by user before including any -uBLAS headers. They may also be automatically defined for some -compilers to work around compile bugs. -
            -
          • BOOST_UBLAS_USE_LONG_DOUBLE Enable uBLAS expressions that -involve containers of 'long double'
          • -BOOST_UBLAS_USE_INTERVAL Enable uBLAS expressions that involve -containers of 'boost::numeric::interval' types
          • -BOOST_UBLAS_SIMPLE_ET_DEBUG In order to simplify debugging is is -possible to simplify expression templateso they are restricted to a -single operation - -
          • BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS enable automatic -conversion from proxy class to matrix expression
          • -BOOST_UBLAS_NO_ELEMENT_PROXIES Disables the use of element proxies -for gappy types.
          • The Gappy types (sparse, coordinate, -compressed) store non-zero elements in their own containers. When new -non-zero elements are assigned they must rearrange these -containers. This invalidates references, iterators or pointers to -these elements. This can happen at some surprising times such as the -expression "a [1] = a [0] = 1;". Element proxies guarantee all such -expressions will work as expected. However they bring their own -restrictions and efficiency problems. For example as of Boost 1.30.0 -they prevent the assignment of elements between different types. -
          • -
          • BOOST_UBLAS_REFERENCE_CONST_MEMBER Enable to allow refernces -to be returned to fixed (zero or one) elements of triangular or banded -matrices - -
          • BOOST_UBLAS_NO_EXCEPTIONS Disable the use exceptions of -uBLAS internal checks and error conditions. BOOST_NO_EXCEPTIONS has -same effect. -
          • -
          • BOOST_UBLAS_SINGULAR_CHECK Check the for singularity in triangular solve() functions
          • -
          -
        • -
        - -
        - -
        -

        - - -Last modified: Wed Sep 16 23:16:45 CEST 2009 - -

        -
        - - - diff --git a/doc/overview.html b/doc/overview.html deleted file mode 100644 index 1ce347dc3..000000000 --- a/doc/overview.html +++ /dev/null @@ -1,965 +0,0 @@ - - - - - - - - - - -uBLAS Overview - - -

        logouBLAS Overview

        -
        -

        Rationale

        -

        It would be nice if every kind of numeric software could -be written in C++ without loss of efficiency, but unless something -can be found that achieves this without compromising the C++ type -system it may be preferable to rely on Fortran, assembler or -architecture-specific extensions (Bjarne Stroustrup).

        -

        This C++ library is directed towards scientific computing on the -level of basic linear algebra constructions with matrices and -vectors and their corresponding abstract operations. The primary -design goals were:

        -
          -
        • mathematical notation
        • -
        • efficiency
        • -
        • functionality
        • -
        • compatibility
        • -
        -

        Another intention was to evaluate, if the abstraction penalty -resulting from the use of such matrix and vector classes is -acceptable.

        -

        Resources

        -

        The development of this library was guided by a couple of -similar efforts:

        -
          -
        • BLAS by -Jack Dongarra et al.
        • -
        • Blitz++ by Todd -Veldhuizen
        • -
        • POOMA by Scott -Haney et al.
        • -
        • MTL by Jeremy -Siek et al.
        • -
        -

        BLAS seems to be the most widely used library for basic linear -algebra constructions, so it could be called a de-facto standard. -Its interface is procedural, the individual functions are somewhat -abstracted from simple linear algebra operations. Due to the fact -that is has been implemented using Fortran and its optimizations, -it also seems to be one of the fastest libraries available. As we -decided to design and implement our library in an object-oriented -way, the technical approaches are distinct. However anyone should -be able to express BLAS abstractions in terms of our library -operators and to compare the efficiency of the implementations.

        -

        Blitz++ is an impressive library implemented in C++. Its main -design seems to be oriented towards multidimensional arrays and -their associated operators including tensors. The author of Blitz++ -states, that the library achieves performance on par or better than -corresponding Fortran code due to his implementation technique -using expression templates and template metaprograms. However we -see some reasons, to develop an own design and implementation -approach. We do not know whether anybody tries to implement -traditional linear algebra and other numerical algorithms using -Blitz++. We also presume that even today Blitz++ needs the most -advanced C++ compiler technology due to its implementation idioms. -On the other hand, Blitz++ convinced us, that the use of expression -templates is mandatory to reduce the abstraction penalty to an -acceptable limit.

        -

        POOMA's design goals seem to parallel Blitz++'s in many parts . -It extends Blitz++'s concepts with classes from the domains of -partial differential equations and theoretical physics. The -implementation supports even parallel architectures.

        -

        MTL is another approach supporting basic linear algebra -operations in C++. Its design mainly seems to be influenced by BLAS -and the C++ Standard Template Library. We share the insight that a -linear algebra library has to provide functionality comparable to -BLAS. On the other hand we think, that the concepts of the C++ -standard library have not yet been proven to support numerical -computations as needed. As another difference MTL currently does -not seem to use expression templates. This may result in one of two -consequences: a possible loss of expressiveness or a possible loss -of performance.

        -

        Concepts

        -

        Mathematical Notation

        -

        The usage of mathematical notation may ease the development of -scientific algorithms. So a C++ library implementing basic linear -algebra concepts carefully should overload selected C++ operators -on matrix and vector classes.

        -

        We decided to use operator overloading for the following -primitives:

        - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        DescriptionOperator
        Indexing of vectors and matricesvector::operator(size_t i);
        -matrix::operator(size_t i, size_t j);
        Assignment of vectors and matricesvector::operator = (const vector_expression &);
        -vector::operator += (const vector_expression &);
        -vector::operator -= (const vector_expression &);
        -vector::operator *= (const scalar_expression &);
        -matrix::operator = (const matrix_expression &);
        -matrix::operator += (const matrix_expression &);
        -matrix::operator -= (const matrix_expression &);
        -matrix::operator *= (const scalar_expression &);
        Unary operations on vectors and matricesvector_expression operator - (const vector_expression -&);
        -matrix_expression operator - (const matrix_expression -&);
        Binary operations on vectors and matricesvector_expression operator + (const vector_expression -&, const vector_expression &);
        -vector_expression operator - (const vector_expression &, const -vector_expression &);
        -matrix_expression operator + (const matrix_expression &, const -matrix_expression &);
        -matrix_expression operator - (const matrix_expression &, const -matrix_expression &);
        Multiplication of vectors and matrices with a scalarvector_expression operator * (const scalar_expression -&, const vector_expression &);
        -vector_expression operator * (const vector_expression &, const -scalar_expression &);
        -matrix_expression operator * (const scalar_expression &, const -matrix_expression &);
        -matrix_expression operator * (const matrix_expression &, const -scalar_expression &);
        -

        We decided to use no operator overloading for the following -other primitives:

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        DescriptionFunction
        Left multiplication of vectors with a matrixvector_expression -prod<vector_type > (const -matrix_expression &, const vector_expression &);
        -vector_expression prod (const matrix_expression &, const -vector_expression &);
        Right multiplication of vectors with a matrixvector_expression -prod<vector_type > (const -vector_expression &, const matrix_expression &);
        -vector_expression prod (const vector_expression &, const -matrix_expression &);
        Multiplication of matricesmatrix_expression -prod<matrix_type > (const -matrix_expression &, const matrix_expression &);
        -matrix_expression prod (const matrix_expression &, const -matrix_expression &);
        Inner product of vectorsscalar_expression inner_prod (const vector_expression -&, const vector_expression &);
        Outer product of vectorsmatrix_expression outer_prod (const vector_expression -&, const vector_expression &);
        Transpose of a matrixmatrix_expression trans (const matrix_expression -&);
        -

        Efficiency

        -

        To achieve the goal of efficiency for numerical computing, one -has to overcome two difficulties in formulating abstractions with -C++, namely temporaries and virtual function calls. Expression -templates solve these problems, but tend to slow down compilation -times.

        -

        Eliminating Temporaries

        -

        Abstract formulas on vectors and matrices normally compose a -couple of unary and binary operations. The conventional way of -evaluating such a formula is first to evaluate every leaf operation -of a composition into a temporary and next to evaluate the -composite resulting in another temporary. This method is expensive -in terms of time especially for small and space especially for -large vectors and matrices. The approach to solve this problem is -to use lazy evaluation as known from modern functional programming -languages. The principle of this approach is to evaluate a complex -expression element wise and to assign it directly to the -target.

        -

        Two interesting and dangerous facts result:

        -

        Aliases

        -

        One may get serious side effects using element wise -evaluation on vectors or matrices. Consider the matrix vector -product x = A x. Evaluation of -A1x and assignment to -x1 changes the right hand side, so -that the evaluation of A2x -returns a wrong result. In this case there are aliases of the elements -xn on both the left and right hand side of the assignment.

        -

        Our solution for this problem is to -evaluate the right hand side of an assignment into a temporary and -then to assign this temporary to the left hand side. To allow -further optimizations, we provide a corresponding member function -for every assignment operator and also a - noalias syntax. -By using this syntax a programmer can confirm, that the left and right hand sides of an -assignment are independent, so that element wise evaluation and -direct assignment to the target is safe.

        -

        Complexity

        -

        The computational complexity may be unexpectedly large under certain -cirumstances. Consider the chained matrix vector product A (B -x). Conventional evaluation of A (B x) is quadratic. -Deferred evaluation of B xi is linear. -As every element B xi is needed -linearly depending of the size, a completely deferred evaluation of -the chained matrix vector product A (B x) is cubic. In -such cases one needs to reintroduce temporaries in the -expression.

        -

        Eliminating Virtual Function Calls

        -

        Lazy expression evaluation normally leads to the definition of a -class hierarchy of terms. This results in the usage of dynamic -polymorphism to access single elements of vectors and matrices, -which is also known to be expensive in terms of time. A solution -was found a couple of years ago independently by David Vandervoorde -and Todd Veldhuizen and is commonly called expression templates. -Expression templates contain lazy evaluation and replace dynamic -polymorphism with static, i.e. compile time polymorphism. -Expression templates heavily depend on the famous Barton-Nackman -trick, also coined 'curiously defined recursive templates' by Jim -Coplien.

        -

        Expression templates form the base of our implementation.

        -

        Compilation times

        -

        It is also a well known fact, that expression templates -challenge currently available compilers. We were able to -significantly reduce the amount of needed expression templates -using the Barton-Nackman trick consequently.

        -

        We also decided to support a dual conventional implementation -(i.e. not using expression templates) with extensive bounds and -type checking of vector and matrix operations to support the -development cycle. Switching from debug mode to release mode is -controlled by the NDEBUG preprocessor symbol of -<cassert>.

        - -

        Functionality

        - -

        Every C++ library supporting linear algebra will be measured -against the long-standing Fortran package BLAS. We now describe how -BLAS calls may be mapped onto our classes.

        - -

        The page Overview of Matrix and Vector Operations -gives a short summary of the most used operations on vectors and -matrices.

        - -

        Blas Level 1

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        BLAS CallMapped Library ExpressionMathematical DescriptionComment
        sasum OR dasumnorm_1 (x)sum |xi|Computes the l1 (sum) norm of a real vector.
        scasum OR dzasumreal (sum (v)) + imag (sum (v))sum re(xi) + sum im(xi)Computes the sum of elements of a complex vector.
        _nrm2norm_2 (x)sqrt (sum -|xi|2 )Computes the l2 (euclidean) norm of a vector.
        i_amaxnorm_inf (x)
        -index_norm_inf (x)
        max |xi|Computes the linf (maximum) norm of a vector.
        -BLAS computes the index of the first element having this -value.
        _dot
        -_dotu
        -_dotc
        inner_prod (x, y)or
        -inner_prod (conj (x), y)
        xT y or
        -xH y
        Computes the inner product of two vectors.
        -BLAS implements certain loop unrollment.
        dsdot
        -sdsdot
        a + prec_inner_prod (x, y)a + xT yComputes the inner product in double precision.
        _copyx = y
        -y.assign (x)
        x <- yCopies one vector to another.
        -BLAS implements certain loop unrollment.
        _swapswap (x, y)x <-> ySwaps two vectors.
        -BLAS implements certain loop unrollment.
        _scal
        -csscal
        -zdscal
        x *= ax <- a xScales a vector.
        -BLAS implements certain loop unrollment.
        _axpyy += a * xy <- a x + yAdds a scaled vector.
        -BLAS implements certain loop unrollment.
        _rot
        -_rotm
        -csrot
        -zdrot
        t.assign (a * x + b * y),
        -y.assign (- b * x + a * y),
        -x.assign (t)
        (x, y) <- (a x + b y, -b x + a y)Applies a plane rotation.
        _rotg
        -_rotmg
         (a, b) <-
        -  (? a / sqrt (a
        2 + -b2),
        -    ? b / sqrt (a
        2 + -b2)) or
        -(1, 0) <- (0, 0)
        Constructs a plane rotation.
        -

        Blas Level 2

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        BLAS CallMapped Library ExpressionMathematical DescriptionComment
        _t_mvx = prod (A, x) or
        -x = prod (trans (A), x)
        or
        -x = prod (herm (A), x)
        x <- A x or
        -x <- A
        T x or
        -x <- A
        H x
        Computes the product of a matrix with a vector.
        _t_svy = solve (A, x, tag) or
        -inplace_solve (A, x, tag) or
        -y = solve (trans (A), x, tag) or
        -inplace_solve (trans (A), x, tag) or
        -y = solve (herm (A), x, tag)or
        -inplace_solve (herm (A), x, tag)
        y <- A-1 x -or
        -x <- A
        -1 x or
        -y <- -A
        T-1 -x or
        -x <- -A
        T-1 -x or
        -y <- -A
        H-1 -x or
        -x <- -A
        H-1 -x
        Solves a system of linear equations with triangular form, i.e. -A is triangular.
        _g_mv
        -_s_mv
        -_h_mv
        y = a * prod (A, x) + b * y or
        -y = a * prod (trans (A), x) + b * y
        or
        -y = a * prod (herm (A), x) + b * y
        y <- a A x + b y or
        -y <- a A
        T x + b y
        -y <- a A
        H x + b y
        Adds the scaled product of a matrix with a vector.
        _g_r
        -_g_ru
        -_g_rc
        A += a * outer_prod (x, y) or
        -A += a * outer_prod (x, conj (y))
        A <- a x yT + A -or
        -A <- a x y
        H + A
        Performs a rank 1 update.
        _s_r
        -_h_r
        A += a * outer_prod (x, x) or
        -A += a * outer_prod (x, conj (x))
        A <- a x xT + A -or
        -A <- a x x
        H + A
        Performs a symmetric or hermitian rank 1 update.
        _s_r2
        -_h_r2
        A += a * outer_prod (x, y) +
        - a * outer_prod (y, x))
        or
        -A += a * outer_prod (x, conj (y)) +
        - conj (a) * outer_prod (y, conj (x)))
        A <- a x yT + a y -xT + A or
        -A <- a x y
        H + -a- y xH + -A
        Performs a symmetric or hermitian rank 2 update.
        -

        Blas Level 3

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        BLAS CallMapped Library ExpressionMathematical DescriptionComment
        _t_mmB = a * prod (A, B) or
        -B = a * prod (trans (A), B) or
        -B = a * prod (A, trans (B)) or
        -B = a * prod (trans (A), trans (B)) or
        -B = a * prod (herm (A), B) or
        -B = a * prod (A, herm (B)) or
        -B = a * prod (herm (A), trans (B)) or
        -B = a * prod (trans (A), herm (B)) or
        -B = a * prod (herm (A), herm (B))
        B <- a op (A) op (B) with
        op (X) = X or
        op (X) = XT or
        op (X) = XH
        Computes the scaled product of two matrices.
        _t_smC = solve (A, B, tag) or
        -inplace_solve (A, B, tag) or
        -C = solve (trans (A), B, tag) or
        -inplace_solve (trans (A), B, tag)
        or
        -C = solve (herm (A), B, tag)
        or
        -inplace_solve (herm (A), B, tag)
        C <- A-1 B -or
        -B <- A
        -1 B or
        -C <- -A
        T-1 -B or
        -B <- A
        -1 B or
        -C <- -A
        H-1 -B or
        -B <- -A
        H-1 -B
        Solves a system of linear equations with triangular form, i.e. -A is triangular.
        _g_mm
        -_s_mm
        -_h_mm
        C = a * prod (A, B) + b * C or
        -C = a * prod (trans (A), B) + b * C or
        -C = a * prod (A, trans (B)) + b * C or
        -C = a * prod (trans (A), trans (B)) + b * C or
        -C = a * prod (herm (A), B) + b * C or
        -C = a * prod (A, herm (B)) + b * C or
        -C = a * prod (herm (A), trans (B)) + b * C or
        -C = a * prod (trans (A), herm (B)) + b * C or
        -C = a * prod (herm (A), herm (B)) + b * C
        C <- a op (A) op (B) + b C with
        op (X) = X or
        op (X) = XT or
        op (X) = XH
        Adds the scaled product of two matrices.
        _s_rk
        -_h_rk
        B = a * prod (A, trans (A)) + b * B or
        -B = a * prod (trans (A), A) + b * B or
        -B = a * prod (A, herm (A)) + b * B or
        -B = a * prod (herm (A), A) + b * B
        B <- a A AT + b B -or
        -B <- a A
        T A + b B or
        -B <- a A AH + b B -or
        -B <- a A
        H A + b B
        Performs a symmetric or hermitian rank k update.
        _s_r2k
        -_h_r2k
        C = a * prod (A, trans (B)) +
        - a * prod (B, trans (A)) + b * C
        or
        -C = a * prod (trans (A), B) +
        - a * prod (trans (B), A) + b * C
        or
        -C = a * prod (A, herm (B)) +
        - conj (a) * prod (B, herm (A)) + b * C
        or
        -C = a * prod (herm (A), B) +
        - conj (a) * prod (herm (B), A) + b * C
        C <- a A BT + a B -AT + b C or
        -C <- a A
        T B + a -BT A + b C or
        -C <- a A B
        H + -a- B AH + -b C or
        -C <- a A
        H B + -a- BH A + -b C
        Performs a symmetric or hermitian rank 2 k -update.
        - -

        Storage Layout

        - -

        uBLAS supports many different storage layouts. The full details can be -found at the Overview of Types. Most types like -vector<double> and matrix<double> are -by default compatible to C arrays, but can also be configured to contain -FORTAN compatible data. -

        - -

        Compatibility

        -

        For compatibility reasons we provide array like indexing for vectors and matrices. For some types (hermitian, sparse etc) this can be expensive for matrices due to the needed temporary proxy objects.

        -

        uBLAS uses STL compatible allocators for the allocation of the storage required for it's containers.

        -

        Benchmark Results

        -

        The following tables contain results of one of our benchmarks. -This benchmark compares a native C implementation ('C array') and -some library based implementations. The safe variants based on the -library assume aliasing, the fast variants do not use temporaries -and are functionally equivalent to the native C implementation. -Besides the generic vector and matrix classes the benchmark -utilizes special classes c_vector and -c_matrix, which are intended to avoid every overhead -through genericity.

        -

        The benchmark program bench1 was compiled with GCC 4.0 and run on an Athlon 64 3000+. Times are scales for reasonable precision by running bench1 100.

        -

        First we comment the results for double vectors and matrices of dimension 3 and 3 x 3, respectively.

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Comment
        inner_prodC array0.61782Some abstraction penalty
        c_vector0.86554
        vector<unbounded_array>1.02467
        vector + vectorC array0.511122Abstraction penalty: factor 2
        c_vector fast1.17489
        vector<unbounded_array> fast1.32433
        c_vector safe2.02283
        vector<unbounded_array> safe6.9582
        outer_prodC array0.59872Some abstraction penalty
        c_matrix, c_vector fast0.88585
        matrix<unbounded_array>, vector<unbounded_array> fast0.90572
        c_matrix, c_vector safe1.66310
        matrix<unbounded_array>, vector<unbounded_array> safe2.95175
        prod (matrix, vector)C array0.64671No significant abstraction penalty
        c_matrix, c_vector fast0.70613
        matrix<unbounded_array>, vector<unbounded_array> fast0.79543
        c_matrix, c_vector safe0.95452
        matrix<unbounded_array>, vector<unbounded_array> safe2.61164
        matrix + matrixC array0.75686No significant abstraction penalty
        c_matrix fast0.99520
        matrix<unbounded_array> fast1.29399
        c_matrix safe1.7303
        matrix<unbounded_array> safe3.14164
        prod (matrix, matrix)C array0.94457No significant abstraction penalty
        c_matrix fast1.17367
        matrix<unbounded_array> fast1.34320
        c_matrix safe1.56275
        matrix<unbounded_array> safe2.06208
        -

        We notice a two fold performance loss for small vectors and matrices: first the general abstraction penalty for using classes, and then a small loss when using the generic vector and matrix classes. The difference w.r.t. alias assumptions is also significant.

        -

        Next we comment the results for double vectors and matrices of -dimension 100 and 100 x 100, respectively.

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        OperationImplementationElapsed [s]MFLOP/sComment
        inner_prodC array0.64889No significant abstraction penalty
        c_vector0.66862
        vector<unbounded_array>0.66862
        vector + vectorC array0.64894No significant abstraction penalty
        c_vector fast0.66867
        vector<unbounded_array> fast0.66867
        c_vector safe1.14501
        vector<unbounded_array> safe1.23465
        outer_prodC array0.501144No significant abstraction penalty
        c_matrix, c_vector fast0.71806
        matrix<unbounded_array>, vector<unbounded_array> fast0.571004
        c_matrix, c_vector safe1.91300
        matrix<unbounded_array>, vector<unbounded_array> safe0.89643
        prod (matrix, vector)C array0.65876No significant abstraction penalty
        c_matrix, c_vector fast0.65876
        matrix<unbounded_array>, vector<unbounded_array> -fast0.66863
        c_matrix, c_vector safe0.66863
        matrix<unbounded_array>, vector<unbounded_array> -safe0.66863
        matrix + matrixC array0.96596No significant abstraction penalty
        c_matrix fast1.21473
        matrix<unbounded_array> fast1.00572
        c_matrix safe2.44235
        matrix<unbounded_array> safe1.30440
        prod (matrix, matrix)C array0.70813No significant abstraction penalty
        c_matrix fast0.73780
        matrix<unbounded_array> fast0.76749
        c_matrix safe0.75759
        matrix<unbounded_array> safe0.76749
        -

        For larger vectors and matrices the general abstraction penalty -for using classes seems to decrease, the small loss when using -generic vector and matrix classes seems to remain. The difference -w.r.t. alias assumptions remains visible, too.

        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/products.html b/doc/products.html deleted file mode 100644 index 563a4b8ce..000000000 --- a/doc/products.html +++ /dev/null @@ -1,318 +0,0 @@ -?xml version="1.0" encoding="UTF-8"?> - - - - Special Products - - - - - - - - - - -

        Special Products

        -
        - -

        Functions

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        template<class V, class E1, class E2> BOOST_UBLAS_INLINE V & axpy_prod (const matrix_expression< E1 > &e1, const vector_expression< E2 > &e2, V &v, bool init=true)
         computes v += A x or v = A x in an optimized fashion.

        template<class V, class E1, class E2> BOOST_UBLAS_INLINE V & axpy_prod (const vector_expression< E1 > &e1, const matrix_expression< E2 > &e2, V &v, bool init=true)
         computes v += AT x or v = AT x in an optimized fashion.

        template<class M, class E1, class E2> BOOST_UBLAS_INLINE M & axpy_prod (const matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, bool init=true)
         computes M += A X or M = A X in an optimized fashion.

        template<class M, class E1, class E2> BOOST_UBLAS_INLINE M & opb_prod (const matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, bool init=true)
         computes M += A X or M = A X in an optimized fashion.

        - -
        - - - - - - -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        BOOST_UBLAS_INLINE V& axpy_prod const matrix_expression< E1 > &  e1,
        const vector_expression< E2 > &  e2,
        V &  v,
        bool  init = true
        -
        - - - - - -
        -   - - -

        -computes v += A x or v = A x in an optimized fashion. -

        -
        Parameters:
        - - - - - -
        e1 the matrix expression A
        e2 the vector expression x
        v the result vector v
        init a boolean parameter
        -
        -axpy_prod(A, x, v, init) implements the well known axpy-product. Setting init to true is equivalent to call v.clear() before axpy_prod. Currently init defaults to true, but this may change in the future.

        -Up to now there are some specialisation for compressed matrices that give a large speed up compared to prod.

        - - - - - - - -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        BOOST_UBLAS_INLINE V& axpy_prod const vector_expression< E1 > &  e1,
        const matrix_expression< E2 > &  e2,
        V &  v,
        bool  init = true
        -
        - - - - - -
        -   - - -

        -computes v += AT x or v = AT x in an optimized fashion. -

        -
        Parameters:
        - - - - - -
        e1 the vector expression x
        e2 the matrix expression A
        v the result vector v
        init a boolean parameter
        -
        -axpy_prod(x, A, v, init) implements the well known axpy-product. Setting init to true is equivalent to call v.clear() before axpy_prod. Currently init defaults to true, but this may change in the future.

        -Up to now there are some specialisation for compressed matrices that give a large speed up compared to prod.

        - - - - - - -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        BOOST_UBLAS_INLINE M& axpy_prod const matrix_expression< E1 > &  e1,
        const matrix_expression< E2 > &  e2,
        M &  m,
        bool  init = true
        -
        - - - - - -
        -   - - -

        -computes M += A X or M = A X in an optimized fashion. -

        -
        Parameters:
        - - - - - -
        e1 the matrix expression A
        e2 the matrix expression X
        m the result matrix M
        init a boolean parameter
        -
        -axpy_prod(A, X, M, init) implements the well known axpy-product. Setting init to true is equivalent to call M.clear() before axpy_prod. Currently init defaults to true, but this may change in the future.

        -Up to now there are no specialisations.

        - - - - - - - -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        BOOST_UBLAS_INLINE M& opb_prod const matrix_expression< E1 > &  e1,
        const matrix_expression< E2 > &  e2,
        M &  m,
        bool  init = true
        -
        - - - - - -
        -   - - -

        -computes M += A X or M = A X in an optimized fashion. -

        -
        Parameters:
        - - - - - -
        e1 the matrix expression A
        e2 the matrix expression X
        m the result matrix M
        init a boolean parameter
        -
        -opb_prod(A, X, M, init) implements the well known axpy-product. Setting init to true is equivalent to call M.clear() before opb_prod. Currently init defaults to true, but this may change in the future.

        -This function may give a speedup if A has less columns than rows, because the product is computed as a sum of outer products.

        - - - -
        -

        Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, -Joerg Walter, Gunter Winkler
        - 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 - ). -

        - - - diff --git a/doc/range.html b/doc/range.html deleted file mode 100644 index 37213bee9..000000000 --- a/doc/range.html +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - -Range and slice - - -

        Range and Slice Storage

        -
        -

        Range<SizeType,DistanceType>

        -

        Description

        -

        The class range specifies a range of indicies. The range is a sequence of indices -from a start value to stop value. The indices increase by one and exlude the stop value. -range can therefore be used to specify ranges of elements from vectors and matrices.

        -

        Example

        -
        -#include <boost/numeric/ublas/storage.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    range r (0, 3);
        -    for (unsigned i = 0; i < r.size (); ++ i) {
        -        std::cout << r (i) << std::endl;
        -    }
        -}
        -
        -

        Definition

        -

        Defined in the header storage.hpp.

        -

        Model of

        -

        Reversible Container.

        -

        Type requirements

        -

        None, except for those imposed by the requirements of Reversible -Container.

        -

        Public base classes

        -

        None.

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        range (size_type start, size_type stop)Constructs a range of indicies from start to stop (excluded) -.
        size_type start () constReturns the beginning of the range.
        size_type size () constReturns the size of the range.
        const_reference operator [] (size_type i) -constReturns the value start + i of the i --th element.
        range compose (const range &r) constReturns the composite range from start + r.start -() to start + r.start () + r.size ().
        bool operator == (const range &r) constTests two ranges for equality.
        bool operator != (const range &r) constTests two ranges for inequality.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the range.
        const_iterator end () constReturns a const_iterator pointing to the end of -the range.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed range.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed range.
        -

        Preconditions

        -
          -
        • start () <= stop ()
        • -
        - -

        Slice<SizeType,DistanceType>

        -

        Description

        -

        The class slice specifies a 'slice' of indicies. Slices are more general -then ranges, the stride allows the sequence of indicies to increase and decrease by the specified amount between element. -slice can therefore be used to specify slices of element from vectors and matrices.

        -

        Example

        -
        -#include <boost/numeric/ublas/storage.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    slice s (0, 1, 3);
        -    for (unsigned i = 0; i < s.size (); ++ i) {
        -        std::cout << s (i) << std::endl;
        -    }
        -}
        -
        -

        Definition

        -

        Defined in the header storage.hpp.

        -

        Model of

        -

        Reversible Container.

        -

        Type requirements

        -

        None, except for those imposed by the requirements of Reversible -Container.

        -

        Public base classes

        -

        None.

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        slice (size_type start, size_type stride, size_type -size)Constructs a slice start,start+stride,start+2*stride... with -size elements.
        size_type start () constReturns the beginning of the slice.
        size_type stride () constReturns the stride of the slice.
        size_type size () constReturns the size of the slice.
        const_reference operator [] (size_type i) -constReturns the value start + i * stride of the -i-th element.
        slice compose (const range &r) constReturns the composite slice from start + stride * r.start -() to start + stride * (r.start () + r.size ()) -with stride stride.
        slice compose (const slice &s) constReturns the composite slice from start + stride * s.start -() to start + stride * s.stride () * (s.start () + -s.size ()) with stride stride * s.stride () -.
        bool operator == (const slice &s) constTests two slices for equality.
        bool operator != (const slice &s) constTests two slices for inequality.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the slice.
        const_iterator end () constReturns a const_iterator pointing to the end of -the slice.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed slice.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed slice.
        -

        Preconditions

        -
          -
        • None all strides are vaild. However when an index is returned or an iterator is dereferenced its -value must be representable as the size_type.
        • -
        -
        -

        - Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, - Joerg Walter, Gunter Winkler
        - 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 - ). -

        - - - diff --git a/doc/release_notes.html b/doc/release_notes.html deleted file mode 100644 index 806d794dc..000000000 --- a/doc/release_notes.html +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - -Boost Basic Linear Algebra - Release Notes - - -

        logoBoost Basic Linear Algebra - Release Notes

        - - -
        - -

        Release 1.70.0

        - -

        improvements

        - -
          -
        • Add support for GPU-accelerated operations via Boost.Compute
        • -
        • Add support for a new (arbitrary-rank) tensor type and associated operations.
        • -
        - -

        Release 1.52.0

        - -

        improvements

        - -
          -
        • [4024] improve performance of inplace_solve
        • -
        • [6511] Division by scalar should use enable_if<>
        • -
        • [7297] Make the free functions 'num_columns' and 'num_rows' support the uBLAS traits system and better work with expression types
        • -
        - -

        bug fixes

        - -
          -
        • [7296] fixes and improvements to test utility functions
        • -
        • [7363] fixed coordinate_matrix::sort() for gcc 4.7 and others
        • -
        - -

        Release 1.43.0

        - -

        bug fixes

        - -
          -
        • [3968] fixed coordinate_matrix sort problem on MSVC10 -
        • -
        • [3539] - changed computation of norm_inf for complex types to match - mathematical definition.
          - Note: This might cause a performance drop - because now std::abs(z) is called for each vector element. - The old implementation used std::max(std::abs(real(z)),std::abs(imag(z)). - Further norm_inf and norm_1 will now return - the same values for complex vector. -
        • -
        • [3501] Moved free functions in concepts.hpp into anonymous namespace. -
        • -
        - -

        Release 1.41.1

        - -

        new features

        - -
          -
        • Move semantics of vector/matrix container assignments have been -implemented. They can be enabled by setting -BOOST_UBLAS_MOVE_SEMANTICS. More details are on the preprocessor options page. -
        • -
        • Introduce new free functions. See [3449], -the new tests in libs/numeric/ublas/test and the inline documentation of the files in boost/numeric/ublas/operation/. -
        • -
        - -

        bug fixes

        - -
          -
        • [3293] Fix resizing problem in identity_matrix -
        • -
        • [3499] Add DefaultConstructible to concept checks -
        • -
        - -

        Release 1.40.0 and before

        -
          -
        • Release notes were not available in this form.
        • -
        - -
        -

        Copyright (©) 2000-2009 Joerg Walter, Mathias Koch, Gunter Winkler
        - 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 - ). -

        - - - - diff --git a/doc/storage_concept.html b/doc/storage_concept.html deleted file mode 100644 index 2f30529e8..000000000 --- a/doc/storage_concept.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - -Storage concept - - -

        Storage concept

        -
        -

        Storage concept

        -

        Description

        -

        Storage is a variable-size container whose elements are arranged in a strict linear order. -

        Storage extends the STL Container concept with some STL Sequence-like functionality. The main difference with -the Sequence concept however is that the Storage concept does not require default-initialisation of its -elements. -

        Refinement of

        -Random Access Container -and -Default Constructible -

        Associated types

        -No additional types beyond those defined by -Random Access Container -

        Notation

        - - - - - -
        XA type that is model of Storage
        TThe value_type of X
        tAn object of type T
        nobject of type convertible to X::size_type
        -

        Definitions

        -

        Valid expressions

        -In addition to the expressions defined in -Random Access Container, -and -Default Constructible -the following expressions must be valid: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        NameExpressionType requirementsReturn type
        Size constructorX(n)T is DefaultConstructibleX
        Fill constructorX(n,t)X
        Range constructorX(i, j)i and j are Input Iterators whose value type is convertible to T X
        Resizea.resize(n, t)a is mutablevoid
        Resizea.resize(n)a is mutablevoid
        -

        Expression semantics

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        NameExpressionPreconditionSemanticsPostcondition -
        Default-constructorX() -Creates 0 elements. -size()==0
        Size-constructorX(n) -n>=0Creates n elements. Elements are constructed without an initializer. That is -if T is a (possibly cv-qualified) non-POD class type (or array thereof), the object is default -initialized. Otherwise, the object created has indeterminate value. See the sentance -"If new initializer is omitted" in section 5.3.4 paragraph 15 of the ISO C++ standard. -size()==n
        Fill-constructorX(n,t) -n>=0Creates n initialised element with copies of tsize()==n
        Range constructorX(i, j)[i,j) is a valid range.copies the range [i,j) to the storagesize() is equal to the distance from i to j. Each element is a copy of the corresponding element in the range [i,j).
        Resizea.resize(n, t)n <= a.max_size()Modified the container so that it has exactly n elements.
        -The container may be reallocated if its size changes. -Existing element values are preserved, additional elements are copies of t.
        a.size() == n
        Resizea.resize(n)n <= a.max_size()Modified the container so that it has exactly n elements.
        -The container may be reallocated if its size changes. Element values are uninitialised. That is, -each element value may be a previously assigned value or default construced value for T.
        a.size() == n
        -

        Complexity guarantees

        -

        Invariants

        -

        Models

        - -

        Notes

        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - - diff --git a/doc/storage_sparse.html b/doc/storage_sparse.html deleted file mode 100644 index b4899d9b2..000000000 --- a/doc/storage_sparse.html +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - -Sparse Storage - - -

        Sparse Storage

        -
        -

        Default Standard Map

        -

        Description

        -

        The templated class map_std<I, T, ALLOC> provides a -wrapper for the standard library associative container -std::map. The wrapper has one simple purpose. It -allows the definition of a default template parameter (for the -adapted array) when declaring the sparse container types.

        -

        Example

        -
        -#include <boost/numeric/ublas/storage_sparse.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    map_std<int, double> a (3);
        -    for (unsigned i = 0; i < a.size (); ++ i) {
        -        a [i] = i;
        -        std::cout << a [i] << std::endl;
        -    }
        -}
        -
        -

        Definition

        -

        Defined in the header storage_sparse.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        IThe type of index stored in the array.
        TThe type of object stored in the array.
        ALLOCAn STL Allocatorstd::allocator
        -

        Model of

        -

        Reversible Container.

        -

        Type requirements

        -

        None, except for those imposed by the requirements of Reversible -Container.

        -

        Public base classes

        -

        std::map

        -

        Map Array

        -

        Description

        -

        The templated class map_array<I, T, ALLOC> implements a std::map like associative container as a sorted array. It therefore some of the Associative Container interface without having the same semantics as an std::map. -

        At any time the map_array has a capacity up to which new element can be inserted. -If insert would cause the size of the map_array to exceeds its capactity then it is reallocated. Iterators and reference are invalidated. -The capacity can be directly control using the reserve member function. -

        -

        Example

        -
        -#include <boost/numeric/ublas/storage_sparse.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    map_array<int, double> a (3);
        -    for (unsigned i = 0; i < a.size (); ++ i) {
        -        a [i] = i;
        -        std::cout << a [i] << std::endl;
        -    }
        -}
        -
        -

        Definition

        -

        Defined in the header storage_sparse.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        IThe type of index stored in the array.
        TThe type of object stored in the array.
        ALLOCAn STL Allocatorstd::allocator
        -

        Model of

        -

        Reversible Container.

        -

        Type requirements

        -

        None, except for those imposed by the requirements of Reversible -Container.

        -

        Public base classes

        -

        None.

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        map_array (ALLOC &a = ALLOC())Allocates a map_array that holds at most zero -elements.
        map_array (const map_array &c)The copy constructor.
        ~map_array ()Deallocates the map_array itself.
        void reserve (size_type capacity) -Changes themap_array capacity. It can hold at mostcapacity elements without reallocation. The capacity can be reduced such that capacity >= size(). The content of themap_array is preserved.
        size_type size () constReturns the size of the map_array.
        size_type size () constReturns the capacity of the map_array.
        data_reference operator [] (index_type i)Returns a reference of the element that is associated with a -particular index. If the map_array does not already -contain such an element, operator[] inserts the -default T ().
        map_array &operator = (const map_array -&a)The assignment operator.
        map_array &assign_temporary (map_array -&a)Assigns a temporary. May change the array a.
        void swap (map_array &a)Swaps the contents of the arrays.
        std::pair insert (const value_type -&p)Inserts p into the array. The second part of the return value is true -if p was inserted and false if was not inserted because it was aleady -present.
        iterator insert (iterator it, const value_type -&p)Inserts p into the array, using it as -a hint to where it will be inserted.
        void erase (iterator it)Erases the value at it.
        void clear ()Clears the array.
        const_iterator find (index_type i) constFinds an element whose index is i.
        iterator find (index_type i)Finds an element whose index is i.
        const_iterator lower_bound (index_type i) -constFinds the first element whose index is not less than -i .
        iterator lower_bound (index_type i)Finds the first element whose index is not less than -i .
        const_iterator upper_bound (index_type i) -constFinds the first element whose index is greater than -i .
        iterator upper_bound (index_type i)Finds the first element whose index is greater than -i .
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the map_array.
        const_iterator end () constReturns a const_iterator pointing to the end of -the map_array.
        iterator begin ()Returns a iterator pointing to the beginning of -the map_array.
        iterator end ()Returns a iterator pointing to the end of the -map_array.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed map_array.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed map_array.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed map_array.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed map_array.
        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/symmetric.html b/doc/symmetric.html deleted file mode 100644 index c3693bde4..000000000 --- a/doc/symmetric.html +++ /dev/null @@ -1,588 +0,0 @@ - - - - - - - - - -Symmetric Matrix - - -

        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

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the matrix.
        F1Functor describing the type of the symmetric matrix. [1]lower
        F2Functor describing the storage organization. [2]row_major
        AThe 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_container<symmetric_matrix<T, F1, F2, A> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        symmetric_matrix (size_type size)Allocates an uninitialized symmetric_matrix that -holds size rows of size elements.
        symmetric_matrix (const symmetric_matrix -&m)The copy constructor.
        template<class AE>
        -symmetric_matrix (const matrix_expression<AE> -&ae)
        The extended copy constructor.
        void resize (size_type size, bool preserve = -true)Reallocates a symmetric_matrix to hold -size rows of size elements. The existing -elements of the symmetric_matrix are preseved when -specified.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns 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.
        symmetric_matrix &operator = (const symmetric_matrix -&m)The assignment operator.
        symmetric_matrix &assign_temporary (symmetric_matrix -&m)Assigns a temporary. May change the symmetric matrix -m .
        template<class AE>
        -symmetric_matrix &operator = (const matrix_expression<AE> -&ae)
        The extended assignment operator.
        template<class AE>
        -symmetric_matrix &assign (const matrix_expression<AE> -&ae)
        Assigns a matrix expression to the symmetric matrix. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -symmetric_matrix &operator += (const -matrix_expression<AE> &ae)
        A computed assignment operator. Adds the matrix expression to -the symmetric matrix.
        template<class AE>
        -symmetric_matrix &plus_assign (const -matrix_expression<AE> &ae)
        Adds a matrix expression to the symmetric matrix. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -symmetric_matrix &operator -= (const -matrix_expression<AE> &ae)
        A computed assignment operator. Subtracts the matrix expression -from the symmetric matrix.
        template<class AE>
        -symmetric_matrix &minus_assign (const -matrix_expression<AE> &ae)
        Subtracts a matrix expression from the symmetric matrix. Left -and right hand side of the assignment should be independent.
        template<class AT>
        -symmetric_matrix &operator *= (const AT &at)
        A computed assignment operator. Multiplies the symmetric matrix -with a scalar.
        template<class AT>
        -symmetric_matrix &operator /= (const AT &at)
        A computed assignment operator. Divides the symmetric matrix -through a scalar.
        void swap (symmetric_matrix &m)Swaps the contents of the symmetric 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 () constReturns a const_iterator1 pointing to the -beginning of the symmetric_matrix.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the symmetric_matrix.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the symmetric_matrix.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -symmetric_matrix.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the symmetric_matrix.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the symmetric_matrix.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the symmetric_matrix.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -symmetric_matrix.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed symmetric_matrix.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed symmetric_matrix.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed symmetric_matrix.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed symmetric_matrix.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed symmetric_matrix.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed symmetric_matrix.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed symmetric_matrix.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed symmetric_matrix.
        -

        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

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        MThe type of the adapted matrix.
        FFunctor describing the type of the symmetric 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<symmetric_adaptor<M, F> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        symmetric_adaptor ()Constructs a symmetric_adaptor that holds zero -rows of zero elements.
        symmetric_adaptor (matrix_type &data)Constructs a symmetric_adaptor of a matrix.
        symmetric_adaptor (const symmetric_adaptor -&m)The copy constructor.
        template<class AE>
        -symmetric_adaptor (const matrix_expression<AE> -&ae)
        The extended copy constructor.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns 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.
        symmetric_adaptor &operator = (const -symmetric_adaptor &m)The assignment operator.
        symmetric_adaptor &assign_temporary -(symmetric_adaptor &m)Assigns a temporary. May change the symmetric adaptor -m.
        template<class AE>
        -symmetric_adaptor &operator = (const -matrix_expression<AE> &ae)
        The extended assignment operator.
        template<class AE>
        -symmetric_adaptor &assign (const matrix_expression<AE> -&ae)
        Assigns a matrix expression to the symmetric adaptor. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -symmetric_adaptor &operator += (const -matrix_expression<AE> &ae)
        A computed assignment operator. Adds the matrix expression to -the symmetric adaptor.
        template<class AE>
        -symmetric_adaptor &plus_assign (const -matrix_expression<AE> &ae)
        Adds a matrix expression to the symmetric adaptor. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -symmetric_adaptor &operator -= (const -matrix_expression<AE> &ae)
        A computed assignment operator. Subtracts the matrix expression -from the symmetric adaptor.
        template<class AE>
        -symmetric_adaptor &minus_assign (const -matrix_expression<AE> &ae)
        Subtracts a matrix expression from the symmetric adaptor. Left -and right hand side of the assignment should be independent.
        template<class AT>
        -symmetric_adaptor &operator *= (const AT &at)
        A computed assignment operator. Multiplies the symmetric -adaptor with a scalar.
        template<class AT>
        -symmetric_adaptor &operator /= (const AT &at)
        A computed assignment operator. Divides the symmetric adaptor -through a scalar.
        void swap (symmetric_adaptor &m)Swaps the contents of the symmetric adaptors.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the symmetric_adaptor.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the symmetric_adaptor.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the symmetric_adaptor.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -symmetric_adaptor.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the symmetric_adaptor.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the symmetric_adaptor.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the symmetric_adaptor.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -symmetric_adaptor.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed symmetric_adaptor.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed symmetric_adaptor.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed symmetric_adaptor.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed symmetric_adaptor.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed symmetric_adaptor.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed symmetric_adaptor.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed symmetric_adaptor.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed symmetric_adaptor.
        -

        Notes

        -

        [1] -Supported parameters for the type of the symmetric adaptor are -lower and upper.

        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/tensor.html b/doc/tensor.html deleted file mode 100644 index 8b08a2fb8..000000000 --- a/doc/tensor.html +++ /dev/null @@ -1,652 +0,0 @@ - - - - - - - - - - - - - -Tensor - - -

        Tensor

        -
        -

        Tensor

        -

        Description

        -

        The templated class tensor<value_t,format_t,storage_t> is the base container adaptor for dense tensors. -Every element $t_{i_1,i_2,\dots,i_p}$ of a $p$-order $(n_1 \times n_2 \times \cdots \times n_p)$-dimensional tensor $T$ is mapped to $j$-th element of a one-dimensional container where $j = \sum_{r=1}^p i_r \cdot w_r$ with $1 \leq i_r \leq n_r $ for $1 \leq r \leq p$. -For the first-order orientation $w_1 = 1$ and $w_k = n_{k-1} \cdot w_{k-1}$ for $k > 1$. For last-order orientation $w_p = 1$ and $ w_k = n_{k+1} \cdot w_{k+1}$ for $k < p$. -

        -

        Example

        -
        -#include <boost/numeric/ublas/tensor.hpp>
        -
        -int main () {
        -  using namespace boost::numeric::ublas;
        -  tensor<double> t{4,2,3};
        -  for (auto k = 0ul; k < t.size (2); ++ k)
        -    for (auto j = 0ul; j < t.size (1); ++ j)
        -      for (auto i = 0ul; i < t.size (0); ++ i)
        -        t.at(i,j,k) = 3*i + 2*j + 5*k;
        -        
        -  std::cout << t << std::endl;
        -}
        -
        - -

        Definition

        -

        Defined in the header file tensor/tensor.hpp.

        - -

        Model of

        -

        Tensor

        - -

        Type requirements

        -

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

        - -

        Public base classes

        -

        tensor_container<tensor<value_t,format_t,storage_t> >

        - -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        value_tThe type of object stored in the tensor.
        format_tStorage organization. [1]first_order
        storage_tThe type of the Storage array. [2]std::vector<value_t>
        - -

        Member types

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Member typeDescription
        value_typeType value_t of the tensor elements.
        layout_typeFormat of the tensor which is either first_order or last_order.
        array_typeSequence container type that stores all tensor elements and is accessible with a single index.
        strides_typeType of the strides vector basic_strides<std::size_t,layout_type> that stores all tensor elements and is accessible with a single index.
        extents_typeType of the dimension extents vector shape that stores all tensor elements and is accessible with a single index.
        size_typeUnsigned integer which is usually std::size_t.
        difference_typeUnsigned integer which is usually std::ptrdiff_t.
        referenceReference type storage_type::reference which is in most cases value_type&.
        const_referenceConstant reference type storage_type::const_reference which is in most cases const value_type&.
        pointerPointer type storage_type::pointer which is in most cases value_type*.
        const_pointerConstant reference type storage_type::const_reference which is in most cases const value_type*.
        iteratorRandomAccessIterator storage_type::iterator.
        const_iteratorConstant RandomAccessIterator storage_type::const_iterator.
        reverse_iteratorReverse RandomAccessIterator storage_type::reverse_iterator.
        const_reverse_iteratorReverse RandomAccessIterator storage_type::const_reverse_iterator.
        matrix_typeType of the matrix matrix<value_type,layout_type,array_type> with which the tensor type interacts.
        vector_typeType of the vector matrix<value_type,layout_type,array_type> with which the tensor type interacts.
        - -

        Alias templates

        - - - - - - - - - - - - - - - - - - -
        Alias templateDescription
        template<class derived_type>
        using tensor_expression_type = detail::tensor_expression<self_type,derived_type>
        Type of tensor_expression where self_type is the tensor type.
        template<class derived_type>
        using matrix_expression_type = matrix_expression<derived_type>
        Type of matrix_expression.
        template<class derived_type>
        using vector_expression_type = vector_expression<derived_type>
        Type of vector_expression.
        - - -

        Member Functions

        - -

        Construction

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Member functionDescription
        tensor ()Constructs an uninitialized tensor that holds zero elements.
        tensor (std::initializer_list<size_type> list) Constructs an uninitialized tensor where list specifies the dimension extents.
        tensor (extents_type const& s) Constructs an uninitialized tensor where -s specifies the dimension extents.
        tensor (extents_type const& e, array_type const& a) Constructs an uninitialized tensor where -e specifies the dimension extents and a the data elements of the tensor.
        tensor (tensor<value_type,other_layout&rt; const& other)Constructs tensor by copying elements from other where the layout is different from this layout type.
        tensor (tensor const& other)Constructs tensor by copying elements from other.
        tensor (tensor && other)Constructs tensor by moving elements from other.
        tensor (matrix_type const& other)Constructs tensor by copying elements from other matrix. The tensor will have the order 2.
        tensor (matrix_type && other)Constructs tensor by moving elements from other matrix. The tensor will have the order 2.
        tensor (vector_type const& other)Constructs tensor by copying elements from other vector. The tensor will have the order 1.
        tensor (vector_type && other)Constructs tensor by moving elements from other vector. The tensor will have the order 1.
        tensor (tensor_expression_type<derived_type> const& expr)Constructs tensor by evaluating the tensor expression expr and copying all elements of the result.
        tensor (matrix_expression_type<derived_type> const& expr)Constructs tensor by evaluating the matrix expression expr and copying all elements of the result.
        tensor (vector_expression_type<derived_type> const& expr)Constructs tensor by evaluating the vector expression expr and copying all elements of the result.
        - - -

        Assignment

        - - - - - - - - - - - - - - - - - - - - - - - -
        Member functionDescription
        tensor& operator=(tensor_expression_type<derived_type> const& expr)Evaluates the tensor expression expr and copyies all elements of the result.
        tensor& operator=(tensor other)Copies or moves elements of other.
        tensor& operator=(const_reference v)Initialiates all elements of a tensor with v.
        - - -

        Capacity

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Member functionDescription
        bool empty() constReturns true if a tensor has zero elements.
        size_type size() constReturns the number of elements of the tensor.
        size_type rank() constReturns the number of dimensions of the tensor.
        size_type order() constReturns the number of dimensions of the tensor.
        strides_type const& strides() constReturns a constant reference to the strides of the tensor.
        extents_type const& extents() constReturns a constant reference to the extents of the tensor.
        - - - -

        Element access

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Member functionDescription
        pointer data()Returns a pointer the first element of the tensor.
        const_pointer data() constReturns a const_pointer the first element of the tensor.
        reference operator[](size_type j)Returns a reference to the j-th element of the storage array of the tensor. Corresponds to the function call tensor::data()+j
        const_reference operator[](size_type j) constReturns a const_reference to the j-th element of the storage array of the tensor. Corresponds to the function call tensor::data()+j.
        template<class ... size_types>
        reference at(size_type i, size_types ... is)
        Returns a reference to the (i,is...)-th element of the tensor where (i,is...) denotes a multi-index with tensor::order() elements. If sizeof...(is)==0, tensor::operator[i] is called.
        template<class ... size_types>
        const_reference at(size_type i, size_types ... is)
        Returns a const_reference to the (i,is...)-th element of the tensor where (i,is...) denotes a multi-index with tensor::order() elements. If sizeof...(is)==0, tensor::operator[i] is called.
        - - - - -

        Proxy Generation

        - - - - - - - - - - - - - - -
        Member functionDescription
        template<std::size_t I, class ... index_types>
        tensor_index operator()(indices::Index<I> p, index_types ... ps)
        Returns a tensor index instance with index objects (p,ps...) for a tensor contraction where sizeof...(ps)+1 must be equal to tensor::order().
        - - -

        Iterators

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Member functionDescription
        const_iterator begin() constReturns a const_iterator pointing to the first element of the tensor.
        const_iterator cbegin() constReturns a const_iterator pointing to the first element of the tensor.
        iterator begin()Returns an iterator pointing to the first element of the tensor.
        const_iterator end() constReturns a const_iterator pointing to the position after the last element of the tensor.
        const_iterator cend() constReturns a const_iterator pointing to the position after the last element of the tensor.
        iterator begin()Returns an iterator pointing to the position after the last element of the tensor.
        - - -

        Modifiers

        - - - - - - - - - - - - - - -
        Member functionDescription
        void reshape(extents_type const& e, value_type v = value_type{})Reshapes the tensor according to the extents e. If e.product() is greater than tensor::size(), the tensor is resized with v.
        - - -

        Notes

        -

        [1] Supported parameters -for the storage organization are first_order and -last_order.

        -

        [2] Common parameters -for the storage array are std::array<N,T> and -std::vector<T>.

        - -
        -

        Copyright (©) 2018 Cem Bassoy
        - 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 - ). -

        - - - diff --git a/doc/tensor/extents.html b/doc/tensor/extents.html deleted file mode 100644 index 5ad9a34b5..000000000 --- a/doc/tensor/extents.html +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - - - - - -Shape - - -

        Extents

        -
        -

        basic_extents<size_type>

        -

        Description

        -

        The template class basic_extents specifies dimension extents of a tensor instance.

        - -

        Example

        -
        -#include <boost/numeric/ublas/tensor/extents.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    shape s{4,3,2};
        -    for (auto i = 0u; i < s.size(); ++i) {
        -        std::cout << s.at(i) << std::endl;
        -    }
        -}
        -
        -

        Definition

        -

        Defined in the header tensor/extents.hpp.

        - -

        Public base classes

        -

        None.

        - -

        Specialization

        -

        using shape = basic_extents<std::size_t>

        - - -

        Template parameters

        - - - - - - - - - - - -
        ParameterDescription
        size_typeUnsigned integer type.
        - -

        Member types

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Member typeDescription
        value_typeType size_type of the extents.
        size_typeUnsigned integer such as std::size_t.
        referenceReference type which is value_type&.
        const_referenceConstant reference type which is const value_type&.
        pointerPointer type which is value_type*.
        const_pointerConstant reference type which is const value_type*.
        - - - - -

        Member Functions

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Member FunctionDescription
        basic_extents ()Constructs an empty instance of basic_extents.
        basic_extents (std::vector<value_type> const& vector)Constructs an instance copying the content of vector.
        basic_extents (std::vector<value_type> && vector)Constructs an instance moving the content of vector.
        basic_extents (std::initializer_list<value_type> list)Constructs an instance from list.
        basic_extents (const_iterator first, const_iterator last)Constructs an instance from the range specified by [first,last).
        basic_extents (basic_extents const& other)Constructs an instance from other copying its elements.
        basic_extents (basic_extents && other)Constructs an instance from other by moving its elements.
        basic_extents& operator= (basic_extents other)Assigns the elements of other to this instance.
        bool is_scalar() constReturns true if the elements are (1,1,[1,...,1]).
        bool is_vector() constReturns true if the elements are (n,1,[1,...,1]) or (1,n,[1,...,1]) where n>1.
        bool is_matrix() constReturns true if the elements are (m,n,[1,...,1]) where m>1 and n>1.
        bool is_tensor() constReturns true if it is not a scalar, vector or matrix.
        const_pointer data() constReturns a const_pointer to the first element.
        pointer data()Returns a pointer to the first element.
        reference operator[](size_type i)Returns a reference to the i-th element.
        const_reference operator[](size_type i) constReturns a const_reference to the i-th element.
        reference at(size_type i)Returns a reference to the i-th element.
        const_reference at(size_type i) constReturns a const_reference to the i-th element.
        bool empty()Returns true if the container has no elements.
        size_type size() constReturns the number of elements.
        bool valid() constReturns true if size()>1 and all elements are greater than one.
        size_type product() constReturns the multiplication of all entries.
        basic_extents squeeze() constReturns a new instance where entries equal to one are eliminated.
        bool operator==(basic_extents const& b) constReturns true if all elements are equal.
        bool operator!=(basic_extents const& b) constReturns true if some elements are not equal.
        const_iterator begin() constReturns an const_iterator pointing to the first element.
        const_iterator end() constReturns a const_iterator pointing to an element passed the last element.
        std::vector<size_type> base() constReturns a const reference to the private member sequence container holding all elements.
        - - - - -
        -

        -Copyright (©) 2018 Cem Bassoy
        - 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 - ). -

        - - - diff --git a/doc/tensor/strides.html b/doc/tensor/strides.html deleted file mode 100644 index 9af6d839d..000000000 --- a/doc/tensor/strides.html +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - -Strides - - -

        Strides

        -
        -

        basic_strides<size_type, format_type>

        -

        Description

        -

        The template class basic_strides contains weights for a given storage format in order to map multi-indices to scalar memory indices for tensor instances.

        - -

        Example

        -
        -#include <boost/numeric/ublas/tensor/strides.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    auto wf = strides<first_order>(shape{4,3,2});
        -    for (auto i = 0u; i < wf.size(); ++i)
        -        std::cout << wf.at(i) << std::endl;    
        -        // 1,4,12
        -        
        -    auto wl = strides<first_order>(shape{4,3,2});
        -    for (auto i = 0u; i < wl.size(); ++i)
        -        std::cout << wl.at(i) << std::endl;    
        -        // 6,2,1        
        -}
        -
        -

        Definition

        -

        Defined in the header tensor/strides.hpp.

        - -

        Public base classes

        -

        None.

        - -

        Specialization

        -

        template<class format_t>
        using strides = basic_strides<std::size_t,format_t>

        - - -

        Template parameters

        - - - - - - - - - - - -
        ParameterDescription
        size_typeUnsigned integer type.
        - -

        Member types

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Member typeDescription
        value_typeType size_type of the strides.
        size_typeUnsigned integer such as std::size_t.
        referenceReference type which is value_type&.
        const_referenceConstant reference type which is const value_type&.
        pointerPointer type which is value_type*.
        const_pointerConstant pointer type which is const value_type*.
        layout_typeLayout type which can be either boost::numeric::ublas::first_order or boost::numeric::ublas::last_order.
        - - - - -

        Member Functions

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Member FunctionDescription
        basic_strides ()Constructs an empty instance of basic_strides.
        basic_strides (basic_extents<value_type> const& be)Constructs an instance based on the tensor extents specified by be.
        basic_strides (std::vector<value_type> const& v)Constructs an instance copying the content of v.
        basic_strides (std::vector<value_type> && v)Constructs an instance moving the content of v.
        basic_strides (basic_strides const& other)Constructs an instance from other copying its elements.
        basic_strides (basic_strides && other)Constructs an instance from other by moving its elements.
        basic_strides& operator= (basic_strides other)Assigns the elements of other to this instance.
        const_pointer data() constReturns a const_pointer to the first element.
        const_reference operator[](size_type i) constReturns a const_reference to the i-th element.
        const_reference at(size_type i) constReturns a const_reference to the i-th element.
        bool empty()Returns true if the container has no elements.
        size_type size() constReturns the number of elements.
        void clear()Erases all elements.
        bool operator==(basic_strides const& b) constReturns true if all elements are equal.
        bool operator!=(basic_strides const& b) constReturns true if some elements are not equal.
        const_iterator begin() constReturns an const_iterator pointing to the first element.
        const_iterator end() constReturns a const_iterator pointing to an element passed the last element.
        std::vector<size_type> base() constReturns the private member sequence container holding all elements.
        - - - -

        Non-Member Functions

        - - - - - - - - - - - - - - - -
        FunctionDescription
        access(std::vector<size_type> const& i, strides<layout_type> w)Returns relative memory location depending on the multi-index vector i and strides w.
        access(size_type sum, strides<layout_type> w, size_type i, size_types ... is)Returns relative memory location depending on the indices i, is ... and stride vector w (recursive function).
        - - -
        -

        -Copyright (©) 2018 Cem Bassoy
        - 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 - ). -

        - - - diff --git a/doc/tensor/tensor_expression.html b/doc/tensor/tensor_expression.html deleted file mode 100644 index c9e479f8c..000000000 --- a/doc/tensor/tensor_expression.html +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - -Tensor Expressions - - -

        Tensor Expressions

        -
        - - - - -

        Tensor Expression

        -

        Description

        -

        The templated class tensor_expression<T,E> -is required to be a public base of all classes. There is no Tensor Expression concept defined.

        -

        Definition

        -

        Defined in the header tensor/expression.hpp.

        -

        Model of

        -

        None. Not a Tensor Expression! -

        - -

        Type requirements

        -

        None.

        -

        Public base classes

        -

        ublas_expression<E>.

        - -

        Template parameters

        - - - - - - - - - - - - - - - -
        ParameterDescription
        TThe type of the tensor.
        EThe type of the tensor expression.
        - -

        Member types

        - - - - - - - - - - - - - - - - - - - -
        Member typeDescription
        expression_typeType of the derived expression which is E.
        type_categoryTag for categorization which is tensor_tag.
        tensor_typeReference type which is T.
        - -

        Public Member Functions

        - - - - - - - - - - - -
        MemberDescription
        const expression_type &operator()() constReturns a const reference to the derived expression.
        - - -
        -
        - -

        Entrywise Tensor Operations

        - - -

        Binary Tensor Expression

        - -

        Description

        -

        The templated class binary_tensor_expression<T,EL,ER,OP> contains a constant reference to a left and right expression that can be evaluated by using the access operator.

        -

        Definition

        -

        Defined in the header tensor/expression.hpp.

        -

        Model of

        -

        Tensor Expression

        - - -

        Type requirements

        -

        None.

        - -

        Public base classes

        -

        tensor_expression<T,binary_tensor_expression<T,EL,ER,OP>>

        - -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescription
        TType of the tensor.
        ELType of the left binary tensor expression.
        ERType of the right binary tensor expression.
        OPType of the binary operation.
        - -

        Member types

        - - - - - - - - - - - - - - - - - - - - - - - -
        Member typeDescription
        expression_type_leftType of the left expression which is EL.
        expression_type_rightType of the right expression which is ER.
        tensor_typeReference type which is T.
        binary_operationType of the binary operation which is OP.
        - -

        Public Member Functions

        - - - - - - - - - - - -
        MemberDescription
        decltype(auto) operator()(std::size_t i) const Returns a const reference to the i-th element of the expression.
        -
        - - - -

        Unary Tensor Expression

        - - -

        Description

        -

        The templated class unary_tensor_expression<T,E,OP> contains a constant reference to an expression that can be evaluated by using the access operator.

        -

        Definition

        -

        Defined in the header tensor/expression.hpp.

        -

        Model of

        -

        Tensor Expression

        - -

        Type requirements

        -

        None.

        - -

        Public base classes

        -

        tensor_expression<T,unary_tensor_expression<T,E,OP>>

        - -

        Template parameters

        - - - - - - - - - - - - - - - - - - - -
        ParameterDescription
        TType of the tensor.
        EType of the unary tensor expression.
        OPType of the unary operation.
        - -

        Member types

        - - - - - - - - - - - - - - - - - - - -
        Member typeDescription
        expression_typeType of the expression which is E.
        tensor_typeReference type which is T.
        unary_operationType of the unary operation which is OP.
        - -

        Public Member Functions

        - - - - - - - - - - - -
        MemberDescription
        decltype(auto) operator()(std::size_t i) const Returns a const reference to the i-th element of the expression.
        - -
        -

        Copyright (©) 2018 Cem Bassoy
        - 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 - ). -

        - - - diff --git a/doc/tensor/tensor_index.html b/doc/tensor/tensor_index.html deleted file mode 100644 index 1e4ec4cd7..000000000 --- a/doc/tensor/tensor_index.html +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - - - - - - -Shape - - -

        Tensor Index

        -
        -

        tensor_index<value_t, storage_t, array_t, N>

        -

        Description

        -

        The template class tensor_index decorates the tensor template class with indices for tensor contraction.

        - -

        Example

        -
        -#include <boost/numeric/ublas/tensor/einstein.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    shape s{4,3,2};
        -    for (auto i = 0u; i < s.size(); ++i) {
        -        std::cout << s.at(i) << std::endl;
        -    }
        -}
        -
        -

        Definition

        -

        Defined in the header tensor/tensor_einstein.hpp.

        - -

        Public base classes

        -

        None.

        - - - -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescription
        value_tThe type of object stored in the tensor.
        format_tStorage organization of the tensor.
        storage_tThe type of the storage array of the tensor.
        NNumber of indices provided.
        - - - - - -
        -

        -Copyright (©) 2018 Cem Bassoy
        - 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 - ). -

        - - - diff --git a/doc/triangular.html b/doc/triangular.html deleted file mode 100644 index 865e1912b..000000000 --- a/doc/triangular.html +++ /dev/null @@ -1,602 +0,0 @@ - - - - - - - - - -Triangular Matrix - - -

        Triangular Matrix

        -
        -

        Triangular Matrix

        -

        Description

        -

        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.

        -

        Example

        -
        -#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.

        - -

        Definition

        -

        Defined in the header triangular.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the matrix.
        F1Functor describing the type of the triangular matrix. [1]lower
        F2Functor describing the storage organization. [2]row_major
        AThe 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_container<triangular_matrix<T, F1, F2, A> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        triangular_matrix ()Allocates an uninitialized triangular_matrix that -holds zero rows of zero elements.
        triangular_matrix (size_type size1, size_type -size2)Allocates an uninitialized triangular_matrix that -holds size1 rows of size2 elements.
        triangular_matrix (const triangular_matrix -&m)The copy constructor.
        template<class AE>
        -triangular_matrix (const matrix_expression<AE> -&ae)
        The extended copy constructor.
        void resize (size_type size1, size_type size2, bool -preserve = true)Reallocates a triangular_matrix to hold -size1 rows of size2 elements. The -existing elements of the triangular_matrix are -preseved when specified.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns 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.
        triangular_matrix &operator = (const -triangular_matrix &m)The assignment operator.
        triangular_matrix &assign_temporary -(triangular_matrix &m)Assigns a temporary. May change the triangular matrix -m.
        template<class AE>
        -triangular_matrix &operator = (const -matrix_expression<AE> &ae)
        The extended assignment operator.
        template<class AE>
        -triangular_matrix &assign (const matrix_expression<AE> -&ae)
        Assigns a matrix expression to the triangular matrix. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -triangular_matrix &operator += (const -matrix_expression<AE> &ae)
        A computed assignment operator. Adds the matrix expression to -the triangular matrix.
        template<class AE>
        -triangular_matrix &plus_assign (const -matrix_expression<AE> &ae)
        Adds a matrix expression to the triangular matrix. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -triangular_matrix &operator -= (const -matrix_expression<AE> &ae)
        A computed assignment operator. Subtracts the matrix expression -from the triangular matrix.
        template<class AE>
        -triangular_matrix &minus_assign (const -matrix_expression<AE> &ae)
        Subtracts a matrix expression from the triangular matrix. Left -and right hand side of the assignment should be independent.
        template<class AT>
        -triangular_matrix &operator *= (const AT &at)
        A computed assignment operator. Multiplies the triangular -matrix with a scalar.
        template<class AT>
        -triangular_matrix &operator /= (const AT &at)
        A computed assignment operator. Divides the triangular matrix -through a scalar.
        void swap (triangular_matrix &m)Swaps the contents of the triangular 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 () constReturns a const_iterator1 pointing to the -beginning of the triangular_matrix.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the triangular_matrix.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the triangular_matrix.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -triangular_matrix.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the triangular_matrix.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the triangular_matrix.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the triangular_matrix.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -triangular_matrix.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed triangular_matrix.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed triangular_matrix.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed triangular_matrix.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed triangular_matrix.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed triangular_matrix.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed triangular_matrix.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed triangular_matrix.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed triangular_matrix.
        -

        Notes

        -

        [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> .

        -

        Triangular Adaptor

        -

        Description

        -

        The templated class triangular_adaptor<M, F> -is a triangular matrix adaptor for other matrices.

        -

        Example

        -
        -#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.

        - -

        Definition

        -

        Defined in the header triangular.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        MThe type of the adapted matrix.
        FFunctor describing the type of the triangular 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<triangular_adaptor<M, F> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        triangular_adaptor (matrix_type &data)Constructs a triangular_adaptor of a matrix.
        triangular_adaptor (const triangular_adaptor -&m)The copy constructor.
        template<class AE>
        -triangular_adaptor (const matrix_expression<AE> -&ae)
        The extended copy constructor.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns 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.
        triangular_adaptor &operator = (const -triangular_adaptor &m)The assignment operator.
        triangular_adaptor &assign_temporary -(triangular_adaptor &m)Assigns a temporary. May change the triangular adaptor -m.
        template<class AE>
        -triangular_adaptor &operator = (const -matrix_expression<AE> &ae)
        The extended assignment operator.
        template<class AE>
        -triangular_adaptor &assign (const matrix_expression<AE> -&ae)
        Assigns a matrix expression to the triangular adaptor. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -triangular_adaptor &operator += (const -matrix_expression<AE> &ae)
        A computed assignment operator. Adds the matrix expression to -the triangular adaptor.
        template<class AE>
        -triangular_adaptor &plus_assign (const -matrix_expression<AE> &ae)
        Adds a matrix expression to the triangular adaptor. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -triangular_adaptor &operator -= (const -matrix_expression<AE> &ae)
        A computed assignment operator. Subtracts the matrix expression -from the triangular adaptor.
        template<class AE>
        -triangular_adaptor &minus_assign (const -matrix_expression<AE> &ae)
        Subtracts a matrix expression from the triangular adaptor. Left -and right hand side of the assignment should be independent.
        template<class AT>
        -triangular_adaptor &operator *= (const AT &at)
        A computed assignment operator. Multiplies the triangular -adaptor with a scalar.
        template<class AT>
        -triangular_adaptor &operator /= (const AT &at)
        A computed assignment operator. Divides the triangular adaptor -through a scalar.
        void swap (triangular_adaptor &m)Swaps the contents of the triangular adaptors.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the triangular_adaptor.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the triangular_adaptor.
        iterator1 begin1 ()Returns a iterator1 pointing to the beginning of -the triangular_adaptor.
        iterator1 end1 ()Returns a iterator1 pointing to the end of the -triangular_adaptor.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the triangular_adaptor.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the triangular_adaptor.
        iterator2 begin2 ()Returns a iterator2 pointing to the beginning of -the triangular_adaptor.
        iterator2 end2 ()Returns a iterator2 pointing to the end of the -triangular_adaptor.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed triangular_adaptor.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed triangular_adaptor.
        reverse_iterator1 rbegin1 ()Returns a reverse_iterator1 pointing to the -beginning of the reversed triangular_adaptor.
        reverse_iterator1 rend1 ()Returns a reverse_iterator1 pointing to the end of -the reversed triangular_adaptor.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed triangular_adaptor.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed triangular_adaptor.
        reverse_iterator2 rbegin2 ()Returns a reverse_iterator2 pointing to the -beginning of the reversed triangular_adaptor.
        reverse_iterator2 rend2 ()Returns a reverse_iterator2 pointing to the end of -the reversed triangular_adaptor.
        -

        Notes

        -

        [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
        - 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 - ). -

        - - - diff --git a/doc/types_overview.html b/doc/types_overview.html deleted file mode 100644 index 770a139bd..000000000 --- a/doc/types_overview.html +++ /dev/null @@ -1,608 +0,0 @@ - - - - - - - - - -Types Overview - - -

        Overview of Tensor, Matrix- and Vector Types

        -
        - -
        -
        Contents:
        -
        Vectors
        -
        Vector Proxies
        -
        Matrices
        -
        Matrix Proxies
        -
        Tensors
        -
        Special Storage Layouts
        -
        - - -

        Notation

        - - - - - - - - - - - - - - - - - - - - - -
        Tis the data type. For general linear algebra operations this will be a real type e.g. double, ...
        Fis the orientation type, either -row_major or column_major for matrices and first_order or last_order for tensors
        A, IA, TA is an array storage type, e.g. std::vector, -bounded_array, unbounded_array, ...
        TRIis a triangular functor: lower, -unit_lower, strict_lower, upper, unit_upper, -strict_upper
        M, N, Kare unsigned integer sizes -(std::size_t)
        IBis an index base -(std::size_t)
        VECis any vector type
        MAT is any matrix type
        TEN is any tensor type
        [...]denote optional arguments - for more details -look at the section "storage layout".
        - -

        Vectors

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        DefinitionDescription
        vector<T [, A]>
           v(size);
        a dense vector of values of type T of variable -size. A storage type A can be specified -which defaults to unbounded_array. -Elements are constructed by A, which need not initialise their value.
        bounded_vector<T, N>
           v;
        a dense vector of values of type T of variable size but with maximum -N. The default constructor creates v -with size N. -Elements are constructed by the storage type bounded_array, which need not initialise their value.
        c_vector<T, M>
           v(size);
        a dense vector of values of type T with the given size. -The data is stored as an ordinary C++ array T -data_[M]
        zero_vector<T>
           v(size);
        the zero vector of type T with the given -size.
        unit_vector<T>
           v(size, index);
        the unit vector of type T with the given size. The -vector is zero other then a single specified element. -
        index should be less than size.
        mapped_vector<T [, S]>
           v(size);
        a sparse vector of values of type T of variable -size. The sparse storage type S can be std::map<size_t, -T> or map_array<size_t, T>.
        compressed_vector<T [,IB, IA, TA]>
           v(size);
        a sparse vector of values of type T of variable -size. The non zero values are stored as two seperate arrays - an -index array and a value array. The index array is always sorted and -there is at most one entry for each index.
        coordinate_vector<T [,IB, IA, TA]>
           v(size);
        a sparse vector of values of type T of variable -size. The non zero values are stored as two seperate arrays - an -index array and a value array. The arrays may be out of order with -multiple entries for each vector element. If there are multiple -values for the same index the sum of these values is the real -value.
        -

        Note: the default types are defined in -boost/numeric/ublas/fwd.hpp.

        - -

        Vector Proxies

        - - - - - - - - - - - - - - - - - - - - - - - - - - -
        DefinitionDescription
        vector_range<VEC>
           vr(v, range);
        a vector referencing a continuous subvector of elements of -vector v containing all elements specified by -range.
        vector_slice<VEC>
           vs(v, slice);
        a vector referencing a non continuous subvector of elements of -vector v containing all elements specified by -slice.
        matrix_row<MAT>
           vr(m, index);
        a vector referencing the index-th row of matrix -m
        matrix_column<MAT>
           vc(m, index);
        a vector referencing the index-th column of matrix -m
        - -

        Matrices

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        DefinitionDescription
        matrix<T [, F, A]>
           m(size1, size2);
        a dense matrix of values of type T of variable -size. A storage type A can be specified -which defaults to unbounded_array. -The orientation functor F defaults to -row_major. -Elements are constructed by A, which need not initialise their value.
        bounded_matrix<T, M, N [, F]>
           m;
        a dense matrix of type T with variable size with maximum M-by-N. The orientation functor F -defaults to row_major. The default constructor creates -m with size M-by-N. -Elements are constructed by the storage type bounded_array, which need not initialise their value.
        c_matrix<T, M, N>
           m(size1, size2);
        a dense matrix of values of type T with the given size. -The data is stored as an ordinary C++ array T -data_[N][M]
        vector_of_vector<T [, F, A]>
           m(size1, -size2);
        a dense matrix of values of type T with the given size. -The data is stored as a vector of vectors. The orientation -F defaults to row_major. The storage -type S defaults to -unbounded_array<unbounded_array<T> >
        zero_matrix<T>
           m(size1, size2);
        a zero matrix of type T with the given size.
        identity_matrix<T>
           m(size1, size2);
        an identity matrix of type T with the given size. -The values are v(i,j) = (i==j)?T(1):T().
        scalar_matrix<T>
           m(size1, size2, -value);
        a matrix of type T with the given size that has the -value value everywhere.
        triangular_matrix<T [, TRI, F, A]>
           -m(size);
        a triangular matrix of values of type T of -variable size. Only the nonzero elements are stored in the given -order F. ("triangular packed storage") The triangular -type F defaults to lower, the orientation -type F defaults to row_major.
        banded_matrix<T [, F, A]>
           m(size1, size2, n_lower, -n_upper);
        a banded matrix of values of type T of variable -size with n_lower sub diagonals and -n_upper super diagonals. Only the nonzero elements are -stored in the given order F. ("packed storage")
        symmetric_matrix<T [, TRI, F, A]>
           -m(size);
        a symmetric matrix of values of type T of -variable size. Only the given triangular matrix is stored in the -given order F.
        hermitian_matrix<T [, TRI, F, A]>
           -m(size);
        a hermitian matrix of values of type T of -variable size. Only the given triangular matrix is stored using -the order F.
        mapped_matrix<T, [F, S]>
           m(size1, size2 [, -non_zeros]);
        a sparse matrix of values of type T of variable -size. The sparse storage type S can be either std::map<size_t, -std::map<size_t, T> > or -map_array<size_t, map_array<size_t, -T> >.
        sparse_vector_of_sparse_vector<T, [F, C]>
           m(size1, -size2 [, non_zeros]);
        a sparse matrix of values of type T of variable -size.
        compressed_matrix<T, [F, IB, IA, TA]>
           m(size1, -size2 [, non_zeros]);
        a sparse matrix of values of type T of variable -size. The values are stored in compressed row/column storage.
        coordinate_matrix<T, [F, IB, IA, TA]>
           m(size1, -size2 [, non_zeros]);
        a sparse matrix of values of type T of variable -size. The values are stored in 3 parallel array as triples (i, j, -value). More than one value for each pair of indices is possible, -the real value is the sum of all.
        generalized_vector_of_vector<T, F, A>
           m(size1, -size2 [, non_zeros]);
        a sparse matrix of values of type T of variable -size. The values are stored as a vector of sparse vectors, e.g. -generalized_vector_of_vector<double, row_major, -unbounded_array<coordinate_vector<double> > >
        -

        Note: the default types are defined in -boost/numeric/ublas/fwd.hpp.

        - -

        Matrix Proxies

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        DefinitionDescription
        triangular_adaptor<MAT, TRI>
           ta(m);
        a triangular matrix referencing a selection of elements of the -matrix m.
        symmetric_adaptor<MAT, TRI>
           sa(m);
        a symmetric matrix referencing a selection of elements of the -matrix m.
        hermitian_adaptor<MAT, TRI>
           ha(m);
        a hermitian matrix referencing a selection of elements of the -matrix m.
        banded_adaptor<MAT>
           ba(m, n_lower, -n_upper);
        a banded matrix referencing a selection of elements of the -matrix m.
        matrix_range<MAT, TRI>
           mr(m, range1, -range2);
        a matrix referencing a submatrix of elements in the matrix -m.
        matrix_slice<MAT, TRI>
           ms(m, slice1, -slice2);
        a matrix referencing a non continues submatrix of elements in -the matrix m.
        - - - -

        Tensors

        - - - - - - - - - - - - - - -
        DefinitionDescription
        tensor<T [, F, A]>
           t(size1, size2, ... );
        a dense matrix of values of type T of variable -size. A storage type A can be specified -which defaults to std::vector<T>. -The orientation type F defaults to -first_order. -Elements are constructed by A, which need not initialise their value.
        - - - - -

        Special Storage Layouts

        - - -

        The library supports conventional dense, packed and basic sparse -vector and matrix storage layouts. The description of the most -common constructions of vectors and matrices comes next.

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ConstructionComment
        vector<T,
        - std::vector<T> >
        -  v (size)
        a dense vector, storage is provided by a standard -vector.
        -The storage layout usually is BLAS compliant.
        vector<T,
        - unbounded_array<T> >
        -  v (size)
        a dense vector, storage is provided by a heap-based -array.
        -The storage layout usually is BLAS compliant.
        vector<T,
        - bounded_array<T, N> >
        -  v (size)
        a dense vector, storage is provided by a stack-based -array.
        -The storage layout usually is BLAS compliant.
        mapped_vector<T,
        - std::map<std::size_t, T> >
        -  v (size, non_zeros)
        a sparse vector, storage is provided by a standard -map.
        mapped_vector<T,
        - map_array<std::size_t, T> >
        -  v (size, non_zeros)
        a sparse vector, storage is provided by a map -array.
        matrix<T,
        - row_major,
        - std::vector<T> >
        -  m (size1, size2)
        a dense matrix, orientation is row major, storage is -provided by a standard vector.
        matrix<T,
        - column_major,
        - std::vector<T> >
        -  m (size1, size2)
        a dense matrix, orientation is column major, storage -is provided by a standard vector.
        -The storage layout usually is BLAS compliant.
        matrix<T,
        - row_major,
        - unbounded_array<T> >
        -  m (size1, size2)
        a dense matrix, orientation is row major, storage is -provided by a heap-based array.
        matrix<T,
        - column_major,
        - unbounded_array<T> >
        -  m (size1, size2)
        a dense matrix, orientation is column major, storage -is provided by a heap-based array.
        -The storage layout usually is BLAS compliant.
        matrix<T,
        - row_major,
        - bounded_array<T, N1 * N2> >
        -  m (size1, size2)
        a dense matrix, orientation is row major, storage is -provided by a stack-based array.
        matrix<T,
        - column_major,
        - bounded_array<T, N1 * N2> >
        -  m (size1, size2)
        a dense matrix, orientation is column major, storage -is provided by a stack-based array.
        -The storage layout usually is BLAS compliant.
        triangular_matrix<T,
        - row_major, F, A>
        -  m (size)
        a packed triangular matrix, orientation is row -major.
        triangular_matrix<T,
        - column_major, F, A>
        -  m (size)
        a packed triangular matrix, orientation is column -major.
        -The storage layout usually is BLAS compliant.
        banded_matrix<T,
        - row_major, A>
        -  m (size1, size2, lower, upper)
        a packed banded matrix, orientation is row -major.
        banded_matrix<T,
        - column_major, A>
        -  m (size1, size2, lower, upper)
        a packed banded matrix, orientation is column -major.
        -The storage layout usually is BLAS compliant.
        symmetric_matrix<T,
        - row_major, F, A>
        -  m (size)
        a packed symmetric matrix, orientation is row -major.
        symmetric_matrix<T,
        - column_major, F, A>
        -  m (size)
        a packed symmetric matrix, orientation is column -major.
        -The storage layout usually is BLAS compliant.
        hermitian_matrix<T,
        - row_major, F, A>
        -  m (size)
        a packed hermitian matrix, orientation is row -major.
        hermitian_matrix<T,
        - column_major, F, A>
        -  m (size)
        a packed hermitian matrix, orientation is column -major.
        -The storage layout usually is BLAS compliant.
        mapped_matrix<T,
        - row_major,
        - std::map<std::size_t, T> >
        -  m (size1, size2, non_zeros)
        a sparse matrix, orientation is row major, storage -is provided by a standard map.
        mapped_matrix<T,
        - column_major,
        - std::map<std::size_t, T> >
        -  m (size1, size2, non_zeros)
        a sparse matrix, orientation is column major, -storage is provided by a standard map.
        mapped_matrix<T,
        - row_major,
        - map_array<std::size_t, T> >
        -  m (size1, size2, non_zeros)
        a sparse matrix, orientation is row major, storage -is provided by a map array.
        mapped_matrix<T,
        - column_major,
        - map_array<std::size_t, T> >
        -  m (size1, size2, non_zeros)
        a sparse matrix, orientation is column major, -storage is provided by a map array.
        compressed_matrix<T,
        - row_major>
        -  m (size1, size2, non_zeros)
        a compressed matrix, orientation is row major.
        -The storage layout usually is BLAS compliant.
        compressed_matrix<T,
        - column_major>
        -  m (size1, size2, non_zeros)
        a compressed matrix, orientation is column -major.
        -The storage layout usually is BLAS compliant.
        coordinate_matrix<T,
        - row_major>
        -  m (size1, size2, non_zeros)
        a coordinate matrix, orientation is row major.
        -The storage layout usually is BLAS compliant.
        coordinate_matrix<T,
        - column_major>
        -  m (size1, size2, non_zeros)
        a coordinate matrix, orientation is column -major.
        -The storage layout usually is BLAS compliant.
        - -
        -

        Copyright (©) 2000-2004 Joerg Walter, Mathias Koch, Gunter -Winkler, Michael Stevens
        - 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 - ). -

        - - - diff --git a/doc/ublas-docinfo-footer.html b/doc/ublas-docinfo-footer.html new file mode 100644 index 000000000..20c80d424 --- /dev/null +++ b/doc/ublas-docinfo-footer.html @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/doc/ublas.adoc b/doc/ublas.adoc new file mode 100644 index 000000000..94dac0c92 --- /dev/null +++ b/doc/ublas.adoc @@ -0,0 +1,86 @@ +//// +Copyright 2021 Shikhar Vashistha + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +//// + +# Boost.Ublas: The Boost Ublas Library +:toc: left +:toclevels: 2 +:idprefix: +:listing-caption: Code Example +:docinfo: private-footer + +:leveloffset: +1 + +include::ublas/overview.adoc[] + +include::ublas/index.adoc[] + +include::ublas/vector.adoc[] + +include::ublas/vector_sparse.adoc[] + +include::ublas/vector_proxy.adoc[] + +include::ublas/vector_expression.adoc[] + +include::ublas/matrix.adoc[] + +include::ublas/triangular.adoc[] + +include::ublas/symmetric.adoc[] + +include::ublas/hermitian.adoc[] + +include::ublas/banded.adoc[] + +include::ublas/matrix_sparse.adoc[] + +include::ublas/matrix_proxy.adoc[] + +include::ublas/matrix_expression.adoc[] + +include::ublas/tensor.adoc[] + +include::ublas/tensor/tensor_expression.adoc[] + +include::ublas/unbounded_array.adoc[] + +include::ublas/bounded_array.adoc[] + +include::ublas/range.adoc[] + +include::ublas/tensor/extents.adoc[] + +include::ublas/tensor/strides.adoc[] + +include::ublas/tensor/tensor_expression.adoc[] + +include::ublas/tensor/tensor_index.adoc[] + +include::ublas/storage_sparse.adoc[] + +include::ublas/products.adoc[] + +include::ublas/blas.adoc[] + +include::ublas/container_concept.adoc[] + +include::ublas/expression_concept.adoc[] + +include::ublas/storage_concept.adoc[] + +include::ublas/iterator_concept.adoc[] + +:leveloffset: -1 + +[appendix] +## Copyright and License + +This documentation is + +* Copyright 2021 Shikhar Vashistha + +and is distributed under the http://www.boost.org/LICENSE_1_0.txt[Boost Software License, Version 1.0]. diff --git a/doc/ublas.css b/doc/ublas.css deleted file mode 100644 index 1531be7f5..000000000 --- a/doc/ublas.css +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2000-2009 Michael Stevens, Mathias Koch, - * Joerg Walter, Gunter Winkler. - * - * 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). - */ -table { - border-width: medium; - background-color: #F8F8F8; - margin: 1em; -} - -td { - padding-left: 0.5em; - padding-right: 0.5em; -} - -th { - text-align: left; -} - -pre.screen { - border: 1px solid #DCDCDC; - display: block; - font-size: 9pt; - margin: 1pc 4% 0; - padding: 0.5pc; -} - -p.credit { - font-style: italic; -} - -@media print { - div.toc { display: none; } -} - -div.toc { - margin: 10px; - padding: 3px; -} - -div#toc ul { - list-style: none; - margin: 1px; - padding-left: 1em; - margin-bottom: 0.25em; -} - -div#toc ul li ul { - margin-bottom: 0.25em; -} - -div#toc ul li ul li ul { - margin-bottom: 0.25em; -} \ No newline at end of file diff --git a/doc/ublas/banded.adoc b/doc/ublas/banded.adoc new file mode 100644 index 000000000..a48e003e1 --- /dev/null +++ b/doc/ublas/banded.adoc @@ -0,0 +1,394 @@ +== Banded Matrix + +[[toc]] + +=== [#banded_matrix]#Banded Matrix# + +==== Description + +The templated class `banded_matrix` 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 __b__~_i,j_~ = _0_, if _i > j + l_ or _i < j - u_. The storage of +banded matrices is packed. + +==== Example + +[source, cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + banded_matrix 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 + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the matrix. | + +|`F` |Functor describing the storage organization. +link:#banded_matrix_1[[1]] |`row_major` + +|`A` |The type of the adapted array. link:#banded_matrix_2[[2]] +|`unbounded_array` +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`banded_matrix ()` |Allocates an uninitialized `banded_matrix` that +holds zero rows of zero elements. + +|`banded_matrix (size_type size1, size_type size2, size_type lower = 0, size_type upper = 0)` +|Allocates an uninitialized `banded_matrix` that holds +`(lower + 1 + upper)` diagonals around the main diagonal of a matrix +with `size1` rows of `size2` elements. + +|`banded_matrix (const banded_matrix &m)` |The copy constructor. + +|`template banded_matrix (const matrix_expression &ae)` +|The extended copy constructor. + +|`void resize (size_type size1, size_type size2, size_type lower = 0, size_type upper = 0, bool preserve = true)` +|Reallocates a `banded_matrix` to hold `(lower + 1 + upper)` diagonals +around the main diagonal of a matrix with `size1` rows of `size2` +elements. The existing elements of the `banded_matrix` are preseved when +specified. + +|`size_type size1 () const` |Returns the number of rows. + +|`size_type size2 () const` |Returns the number of columns. + +|`size_type lower () const` |Returns the number of diagonals below the +main diagonal. + +|`size_type upper () const` |Returns the number of diagonals above the +main diagonal. + +|`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. + +|`banded_matrix &operator = (const banded_matrix &m)` |The assignment +operator. + +|`banded_matrix &assign_temporary (banded_matrix &m)` |Assigns a +temporary. May change the banded matrix `m` . + +|`template banded_matrix &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template banded_matrix &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the banded matrix. Left and right hand +side of the assignment should be independent. + +|`template banded_matrix &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +banded matrix. + +|`template banded_matrix &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the banded matrix. Left and right hand side +of the assignment should be independent. + +|`template banded_matrix &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the banded matrix. + +|`template banded_matrix &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the banded matrix. Left and right +hand side of the assignment should be independent. + +|`template banded_matrix &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the banded matrix with a +scalar. + +|`template banded_matrix &operator /= (const AT &at)` |A +computed assignment operator. Divides the banded matrix through a +scalar. + +|`void swap (banded_matrix &m)` |Swaps the contents of the banded +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 `banded_matrix`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `banded_matrix`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `banded_matrix`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`banded_matrix`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `banded_matrix`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `banded_matrix`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `banded_matrix`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`banded_matrix`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`banded_matrix`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`banded_matrix`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `banded_matrix`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `banded_matrix`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`banded_matrix`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`banded_matrix`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `banded_matrix`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `banded_matrix`. +|=== + +==== Notes + +[#banded_matrix_1]#[1]# Supported parameters for the storage +organization are `row_major` and `column_major`. + +[#banded_matrix_2]#[2]# Supported parameters for the adapted array are +`unbounded_array` , `bounded_array` and `std::vector` . + +=== [#banded_adaptor]#Banded Adaptor# + +==== Description + +The templated class `banded_adaptor` is a banded matrix adaptor for +other matrices. + +==== Example + +[source, cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + banded_adaptor > 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 + +[cols=",,",] +|=== +|Parameter |Description |Default +|`M` |The type of the adapted matrix. | +|=== + +==== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +==== Public base classes + +`matrix_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`banded_adaptor (matrix_type &data, size_type lower = 0, size_type upper = 0)` +|Constructs a `banded_adaptor` that holds `(lower + 1 + upper)` +diagonals around the main diagonal of a matrix. + +|`banded_adaptor (const banded_adaptor &m)` |The copy constructor. + +|`template banded_adaptor (const matrix_expression &ae)` +|The extended copy constructor. + +|`size_type size1 () const` |Returns the number of rows. + +|`size_type size2 () const` |Returns the number of columns. + +|`size_type lower () const` |Returns the number of diagonals below the +main diagonal. + +|`size_type upper () const` |Returns the number of diagonals above the +main diagonal. + +|`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. + +|`banded_adaptor &operator = (const banded_adaptor &m)` |The assignment +operator. + +|`banded_adaptor &assign_temporary (banded_adaptor &m)` |Assigns a +temporary. May change the banded adaptor `m` . + +|`template banded_adaptor &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template banded_adaptor &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the banded adaptor. Left and right hand +side of the assignment should be independent. + +|`template banded_adaptor &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +banded adaptor. + +|`template banded_adaptor &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the banded adaptor. Left and right hand +side of the assignment should be independent. + +|`template banded_adaptor &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the banded adaptor. + +|`template banded_adaptor &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the banded adaptor. Left and right +hand side of the assignment should be independent. + +|`template banded_adaptor &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the banded adaptor with a +scalar. + +|`template banded_adaptor &operator /= (const AT &at)` |A +computed assignment operator. Divides the banded adaptor through a +scalar. + +|`void swap (banded_adaptor &m)` |Swaps the contents of the banded +adaptors. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `banded_adaptor`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `banded_adaptor`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `banded_adaptor`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`banded_adaptor`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `banded_adaptor`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `banded_adaptor`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `banded_adaptor`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`banded_adaptor`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`banded_adaptor`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`banded_adaptor`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `banded_adaptor`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `banded_adaptor`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`banded_adaptor`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`banded_adaptor`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `banded_adaptor`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `banded_adaptor`. +|=== + +''''' + +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). \ No newline at end of file diff --git a/doc/ublas/blas.adoc b/doc/ublas/blas.adoc new file mode 100644 index 000000000..13b54bc2b --- /dev/null +++ b/doc/ublas/blas.adoc @@ -0,0 +1,230 @@ +== Level 3 BLAS + +[[toc]] + +''''' + +=== Functions +[width="100%",cols="100%",] +|=== + +|template M1 & link:#blas_1[boost::numeric::ublas::blas_3::tmm] (M1 &m1, const T &t, +const M2 &m2, const M3 &m3) triangular matrix multiplication + + +|template M1 & link:#blas_2[boost::numeric::ublas::blas_3::tsm] (M1 &m1, const T &t, +const M2 &m2, C) triangular solve _m2_ * _x_ = _t_ * _m1_ in place, _m2_ is a +triangular matrix + +|template M1 & link:#blas_3[boost::numeric::ublas::blas_3::gmm] (M1 &m1, const T1 &t1, +const T2 &t2, const M2 &m2, const M3 &m3) general matrix multiplication + +|template M1 & link:#blas_4[boost::numeric::ublas::blas_3::srk] (M1 &m1, const T1 &t1, +const T2 &t2, const M2 &m2) symmetric rank k update: _m1_ = _t_ * _m1_ + _t2_ * (_m2_ * _m2^T^_) + +|template M1 & link:#blas_5[boost::numeric::ublas::blas_3::hrk] (M1 &m1, const T1 &t1, +const T2 &t2, const M2 &m2) hermitian rank k update: _m1_ = _t_ * _m1_ + _t2_ * (_m2_ * _m2^H^_) + + +|template M1 & link:#blas_6[boost::numeric::ublas::blas_3::sr2k] (M1 &m1, const T1 &t1, +const T2 &t2, const M2 &m2, const M3 &m3) generalized symmetric rank k update: _m1_ = _t1_ * _m1_ + _t2_ * +(_m2_ * _m3^T^_) + _t2_ * (_m3_ * _m2^T^_) + +|template M1 & link:#blas_7[boost::numeric::ublas::blas_3::hr2k] (M1 &m1, const T1 &t1, +const T2 &t2, const M2 &m2, const M3 &m3) generalized hermitian rank k update: _m1_ = _t1_ * _m1_ + _t2_ * +(_m2_ * _m3^H^_) + (_m3_ * (_t2_ * _m2_)^H^) + +|template BOOST_UBLAS_INLINE M & link:products.adoc#product_3[boost::numeric::ublas::axpy_prod] (const +matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, +bool init=true) computes `M += A X` or `M = A X` in an optimized fashion. + +|template BOOST_UBLAS_INLINE M & link:products.adoc#product_4[boost::numeric::ublas::opb_prod] (const +matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, +bool init=true) computes `M += A X` or `M = A X` in an optimized fashion. +|=== + +''''' + +=== Function Documentation + +[#blas_1]#1.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!M1& tmm !(  !M1 &  !_m1_, +! ! !const T &  !_t_, +! ! !const M2 &  !_m2_, +! ! !const M3 &  !_m3_ +! !)  ! ! +!=== + +|=== + +[cols=",",] +|=== +|  |triangular matrix multiplication +|=== + +[#blas_2]#2.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!M1& tsm !(  !M1 &  !_m1_, +! ! !const T &  !_t_, +! ! !const M2 &  !_m2_, +! ! !C  ! +! !)  ! ! +!=== + +|=== + +[cols=",",] +|=== +|  |triangular solve _m2_ * _x_ = _t_ * _m1_ in place, _m2_ is a +triangular matrix +|=== + +[#blas_3]#3.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!M1& gmm !(  !M1 &  !_m1_, +! ! !const T1 &  !_t1_, +! ! !const T2 &  !_t2_, +! ! !const M2 &  !_m2_, +! ! !const M3 &  !_m3_ +! !)  ! ! +!=== + +|=== + +[cols=",",] +|=== +|  |general matrix multiplication +|=== + +[#blas_4]#4.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!M1& srk !(  !M1 &  !_m1_, +! ! !const T1 &  !_t1_, +! ! !const T2 &  !_t2_, +! ! !const M2 &  !_m2_ +! !)  ! ! +!=== + +|=== + +[width="100%",cols="50%,50%",] +|=== +|  a| +symmetric rank k update: _m1_ = _t_ * _m1_ + _t2_ * (_m2_ * _m2^T^_) + +*Todo:*:: + use opb_prod() + +|=== + +[#blas_5]#5.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!M1& hrk !(  !M1 &  !_m1_, +! ! !const T1 &  !_t1_, +! ! !const T2 &  !_t2_, +! ! !const M2 &  !_m2_ +! !)  ! ! +!=== + +|=== + +[width="100%",cols="50%,50%",] +|=== +|  a| +hermitian rank k update: _m1_ = _t_ * _m1_ + _t2_ * (_m2_ * _m2^H^_) + +*Todo:*:: + use opb_prod() + +|=== + +[#blas_6]#6.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!M1& sr2k !(  !M1 &  !_m1_, +! ! !const T1 &  !_t1_, +! ! !const T2 &  !_t2_, +! ! !const M2 &  !_m2_, +! ! !const M3 &  !_m3_ +! !)  ! ! +!=== + +|=== + +[width="100%",cols="50%,50%",] +|=== +|  a| +generalized symmetric rank k update: _m1_ = _t1_ * _m1_ + _t2_ * (_m2_ * +_m3^T^_) + _t2_ * (_m3_ * _m2^T^_) + +*Todo:*:: + use opb_prod() + +|=== + +[#blas_7]#7.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!M1& hr2k !(  !M1 &  !_m1_, +! ! !const T1 &  !_t1_, +! ! !const T2 &  !_t2_, +! ! !const M2 &  !_m2_, +! ! !const M3 &  !_m3_ +! !)  ! ! +!=== + +|=== + +[width="100%",cols="50%,50%",] +|=== +|  a| +generalized hermitian rank k update: _m1_ = _t1_ * _m1_ + _t2_ * (_m2_ * +_m3^H^_) + (_m3_ * (_t2_ * _m2_)^H^) + +*Todo:*:: + use opb_prod() + +|=== + +''''' + +Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, Joerg Walter, +Gunter Winkler + +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). diff --git a/doc/ublas/bounded_array.adoc b/doc/ublas/bounded_array.adoc new file mode 100644 index 000000000..37ce3cd20 --- /dev/null +++ b/doc/ublas/bounded_array.adoc @@ -0,0 +1,146 @@ +== Bounded Array Storage + +[[toc]] + +=== [#bounded_array]#Bounded Array# + +==== Description + +The templated class `bounded_array` implements a bounded +storage array. The bounded array is similar to a C++ array type in that +its maximum size is bounded by N and is allocated on the stack instead +of the heap. Similarly a `bounded_array` requires no secondary storage +and ALLOC is only used to specify `size_type` and `difference_type`. + +When resized `bounded_array` never reallocated the storage. It is +therefore always efficient to resize a `bounded_array` but the size +bound N must not be exceeded. + +==== Example + +[source, cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + bounded_array a (3); + for (unsigned i = 0; i < a.size (); ++ i) { + a [i] = i; + std::cout << a [i] << std::endl; + } +} +.... + +==== Definition + +Defined in the header storage.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`T` |The type of object stored in the array. | +|`N` |The allocation size of the array. | +|`ALLOC` |An STL Allocator |std::allocator +|=== + +==== Model of + +link:storage_concept.html[Storage] + +==== Type requirements + +None, except for those imposed by the requirements of Storage. + +==== Public base classes + +None. + +==== Members + +* The description does not describe what the member actually does, this +can be looked up in the corresponding concept documentation, but instead +contains a remark on the implementation of the member inside this model +of the concept. +* Typography: +** Members that are not part of the implemented concepts are in blue. + +[cols=",,",] +|=== +|Member |Where defined |Description + +|`value_type`| https://www.boost.org/sgi/stl/Container.html[Container] | + +|`pointer` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `value_type*` + +|`const_pointer` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `const value_type*` + +|`reference` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `value_type&` + +|`const_reference` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `const value_type&` + +|`size_type` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `Alloc::size_type` + +|`difference_type` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `Alloc::difference_type` + +|`iterator` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `pointer` + +|`const_iterator` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `const_pointer` + +|`revere_iterator` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `std::reverse_iterator` + +|`const_revere_iterator` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `std::reverse_iterator` + +|`bounded_array ()` |link:storage_concept.html[Storage] |Creates an `unbounded_array` that holds *zero* elements. + +|`bounded_array (size_type size)` |link:storage_concept.html[Storage] |Creates a uninitialized `bounded_array` that holds `size` elements. All the elements are default constructed. + +|`bounded_array (size_type size, const T& init)` |link:storage_concept.html[Storage] |Creates an initialized `bounded_array` that holds `size` elements. All the elements are constructed from the `init` value. + +|`bounded_array (const bounded_array &c)` |https://www.boost.org/sgi/stl/Container.html[Container] |The copy constructor. + +|`~bounded_array ()` |https://www.boost.org/sgi/stl/Container.html[Container] |Deallocates the `bounded_array` itself. + +|`void resize (size_type size)` |link:storage_concept.html[Storage] |Reallocates a `bounded_array` to hold `size` elements. + +|`void resize (size_type size, const T& t)` |link:storage_concept.html[Storage] |Reallocates a `bounded_array` to hold `size` elements. + +|`size_type size () const` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns the size of the `bounded_array`. + +|`const_reference operator [] (size_type i) const` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a `const` reference of the `i` -th element. + +|`reference operator [] (size_type i)` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a reference of the `i`-th element. + +|`bounded_array &operator = (const bounded_array &a)` |https://www.boost.org/sgi/stl/Container.html[Container] |The assignment operator. + +|`bounded_array &assign_temporary (bounded_array &a)` | |Assigns a temporary. May change the array `a`. + +|`void swap (bounded_array &a)` |https://www.boost.org/sgi/stl/Container.html[Container] |Swaps the contents of the arrays. + +|`const_iterator begin () const` |https://www.boost.org/sgi/stl/Container.html[Container]| Returns a `const_iterator` pointing to the beginning of the `bounded_array`. + +|`const_iterator end () const` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a `const_iterator` pointing to the end of the `bounded_array`. + +|`iterator begin ()` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a `iterator` pointing to the beginning of the `bounded_array`. + +|`iterator end ()` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a `iterator` pointing to the end of the `bounded_array`. + +|`const_reverse_iterator rbegin () const` |https://www.boost.org/sgi/stl/ReversibleContainer.html[Reversible Container] |Returns a `const_reverse_iterator` pointing to the beginning of the reversed `bounded_array`. + +|`const_reverse_iterator rend () const` |https://www.boost.org/sgi/stl/ReversibleContainer.html[Reversible Container] |Returns a `const_reverse_iterator` pointing to the end of the reversed `bounded_array`. + +|`reverse_iterator rbegin ()` |https://www.boost.org/sgi/stl/ReversibleContainer.html[Reversible Container] |Returns a `reverse_iterator` pointing to the beginning of the reversed `bounded_array`. + +|`reverse_iterator rend ()` |https://www.boost.org/sgi/stl/ReversibleContainer.html[Reversible Container] |Returns a `reverse_iterator` pointing to the end of the reversed `bounded_array`. + +|=== +''''' + +Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, Joerg Walter, +Gunter Winkler + +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 ). diff --git a/doc/ublas/container_concept.adoc b/doc/ublas/container_concept.adoc new file mode 100644 index 000000000..1c03e729a --- /dev/null +++ b/doc/ublas/container_concept.adoc @@ -0,0 +1,395 @@ +== Container Concepts + +[[toc]] + +=== [#vector]#Vector# + +==== Description + +A Vector describes common aspects of dense, packed and sparse vectors. + +==== Refinement of + +https://www.boost.org/sgi/stl/DefaultConstructible.html[DefaultConstructible], +link:expression_concept.html#vector_expression[Vector Expression] +link:#vector_expression_note[[1]]. + +==== Associated types + +In addition to the types defined by +link:expression_concept.adoc#vector_expression[Vector Expression] + +[cols=",,",] +|=== +|Public base |vector_container |V must be derived from this public +base type. + +|Storage array |V::array_type |Dense Vector ONLY. The type of underlying +storage array used to store the elements. The array_type must model the +link:storage_concept.adoc[*Storage*] concept. +|=== + +==== Notation + +[cols=",",] +|=== +|`V` |A type that is a model of Vector +|`v` |Objects of type `V` +|`n, i` |Objects of a type convertible to `size_type` +|`t` |Object of a type convertible to `value_type` +|`p` |Object of a type convertible to `bool` +|=== + +==== Definitions + +==== Valid expressions + +In addition to the expressions defined in +https://www.boost.org/sgi/stl/DefaultConstructible.html[DefaultConstructible], +link:expression_concept.adoc#vector_expression[Vector Expression] the +following expressions must be valid. + +[width="100%",cols="25%,25%,25%,25%",] +|=== +|Name |Expression |Type requirements |Return type + +|Sizing constructor |`V v (n)` |  |`V` + +|Insert |`v.insert_element (i, t)` |`v` is mutable. |`void` + +|Erase |`v.erase_element (i)` |`v` is mutable. |`void` + +|Clear |`v.clear ()` |`v` is mutable. |`void` + +|Resize |`v.resize (n)` + +`v.resize (n, p)` |`v` is mutable. |`void` + +|Storage |`v.data()` |`v` is mutable and Dense. |`array_type&` if `v` is +mutable, `const array_type&` otherwise +|=== + +==== Expression semantics + +Semantics of an expression is defined only where it differs from, or is +not defined in link:expression_concept.adoc#vector_expression[Vector +Expression] . + +[width="100%",cols=",,,,",options="header",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition +|Sizing constructor |`V v (n)` |`n >= 0` |Allocates a vector of `n` +elements. |`v.size () == n`. + +|Element access link:#element_access_note[[2]] |`v[n]` |`0v.size()` +|returns the n-th element in v |  + +|Insert |`v.insert_element (i, t)` |`0 < = i < v.size ()`. |Inserts an +element at `v (i)` with value `t`. The storage requirement of the Vector +may be increased. |`v (i)` is equal to `t`. + +|Erase |`v.erase_element (i)` |`0 < = i < v.size ()` |Destroys the +element as `v (i)` and replaces it with the default `value_type ()`. The +storage requirement of the Vector may be decreased. |`v (i)` is equal to +`value_type ()`. + +|Clear |`v.clear ()` |  |Equivalent to + +`for (i = 0; i < v.size (); ++ i)` + +  `v.erase_element (i);` |  + +|Resize |`v.resize (n) v.resize (n, p)` |  |Reallocates the vector so +that it can hold `n` elements. + +Erases or appends elements in order to bring the vector to the +prescribed size. Appended elements copies of `value_type()`. + +When `p == false` then existing elements are not preserved and elements +will not appended as normal. Instead the vector is in the same state as +that after an equivalent sizing constructor. |`v.size () == n`. + +|Storage |`v.data()` | |Returns a reference to the underlying dense +storage. |  +|=== + +==== Complexity guarantees + +The run-time complexity of the sizing constructor is linear in the +vector's size. + +The run-time complexity of insert_element and erase_element is specific +for the Vector model and it depends on increases/decreases in storage +requirements. + +The run-time complexity of resize is linear in the vector's size. + +==== Invariants + +==== Models + +* `vector`, `bounded_vector`, `c_vector` +* `unit_vector`, `zero_vector`, `scalar_vector` +* `mapped_vector;`, `compressed_vector`, `coordinate_vector` + +==== Notes + +[#vector_expression_note]#[1]# As a user you need not care about Vector +being a refinement of the VectorExpression. Being a refinement of the +VectorExpression is only important for the template-expression engine +but not the user. + +[#element_access_note]#[2]# The `operator[]` is added purely for +convenience and compatibility with the `std::vector`. In uBLAS however, +generally `operator()` is used for indexing because this can be used for +both vectors and matrices. + +''''' + +=== [#matrix]#Matrix# + +==== Description + +A Matrix describes common aspects of dense, packed and sparse matrices. + +==== Refinement of + +https://www.boost.org/sgi/stl/DefaultConstructible.html[DefaultConstructible], +link:expression_concept.adoc#matrix_expression[Matrix Expression] +link:#matrix_expression_note[[1]] . + +==== Associated types + +In addition to the types defined by +link:expression_concept.adoc#matrix_expression[Matrix Expression] + +[cols=",,",] +|=== +|Public base |matrix_container |M must be derived from this public +base type. + +|Storage array |M::array_type |Dense Matrix ONLY. The type of underlying +storage array used to store the elements. The array_type must model the +link:storage_concept.adoc[*Storage*] concept. +|=== + +==== Notation + +[cols=",",] +|=== +|`M` |A type that is a model of Matrix +|`m` |Objects of type `M` +|`n1, n2, i, j` |Objects of a type convertible to `size_type` +|`t` |Object of a type convertible to `value_type` +|`p` |Object of a type convertible to `bool` +|=== + +==== Definitions + +==== Valid expressions + +In addition to the expressions defined in +link:expression_concept.adoc#matrix_expression[Matrix Expression] the +following expressions must be valid. + +[width="100%",cols="25%,25%,25%,25%",] +|=== +|Name |Expression |Type requirements |Return type + +|Sizing constructor |`M m (n1, n2)` |  |`M` + +|Insert |`m.insert_element (i, j, t)` |`m` is mutable. |`void` + +|Erase |`m.erase_element (i, j)` |`m` is mutable. |`void` + +|Clear |`m.clear ()` |`m` is mutable. |`void` + +|Resize |`m.resize (n1, n2)` + +`m.resize (n1, n2, p)` |`m` is mutable. |`void` + +|Storage |`m.data()` |`m` is mutable and Dense. |`array_type&` if `m` is +mutable, `const array_type&` otherwise +|=== + +==== Expression semantics + +Semantics of an expression is defined only where it differs from, or is +not defined in link:expression_concept.adoc#matrix_expression[Matrix +Expression] . + +[width="100%",cols=",,,,",options="header",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition + +|Sizing constructor |`M m (n1, n2)` |`n1 >= 0` and `n2 >= 0` |Allocates a matrix of `n1` rows and `n2` columns. |`m.size1 () == n1` and `m.size2 () == n2`. + +|Insert |`m.insert_element (i, j, t)` |`0 < = i < m.size1 ()`, + `0 < = j < m.size2 ()`. |Inserts an element at `m (i, j)` with value `t`. The storage requirement of the Matrix may be increased. `m (i, j)` is equal to `t`. |`m(i,j)` is equal to `t`. + +|Erase |`m.erase_element (i, j)` |`0 <= i < m.size1 ()`and ` 0 <= j < m.size2` |Destroys the element as `m (i, j)` and replaces it with the default `value_type ()`. The storage requirement of the Matrix may be decreased. |`m (i, j)` is equal to `value_type ()`. + +|Clear |`m.clear ()` | |Equivalent to + +`for (i = 0; i < m.size1 (); ++ i) + +  for (j = 0; j < m.size2 (); ++ j) + +    m.erase_element (i, j);` | + +|Resize |`m.resize (n1, n2) m.resize (n1, n2, p)` | |Reallocate the matrix so that it can hold `n1` rows and `n2` columns. + +Erases or appends elements in order to bring the matrix to the +prescribed size. Appended elements are `value_type()` copies. + +When `p == false` then existing elements are not preserved and elements +will not appended as normal. Instead the matrix is in the same state as +that after an equivalent sizing constructor. |`m.size1 () == n1` and `m.size2 () == n2`. + +|Storage |`m.data()` | |Returns a reference to the underlying dense storage. | + +|=== +  + +==== Complexity guarantees + +The run-time complexity of the sizing constructor is quadratic in the +matrix's size. + +The run-time complexity of insert_element and erase_element is specific +for the Matrix model and it depends on increases/decreases in storage +requirements. + +The run-time complexity of resize is quadratic in the matrix's size. + +==== Invariants + +==== Models + +* `matrix`, `bounded_matrix`, `c_matrix` +* `identity_matrix` , `zero_matrix` , `scalar_matrix` +* `triangular_matrix` , `symmetric_matrix` , `banded_matrix` +* `mapped_matrix` , `compressed_matrix` , `coordinate_matrix` + +==== Notes + +[#matrix_expression_note]#[1]# As a user you need not care about Matrix +being a refinement of the MatrixExpression. Being a refinement of the +MatrixExpression is only important for the template-expression engine +but not the user. + +''''' + +=== [#tensor]#Tensor# + +==== Description + +A Tensor describes common aspects of dense multidimensional arrays. + +==== Refinement of + +https://www.boost.org/sgi/stl/DefaultConstructible.html[DefaultConstructible], +link:expression_concept.adoc#tensor_expression[Tensor Expression] +link:#tensor_expression_note[[1]] . + +==== Associated types + +In addition to the types defined by +link:expression_concept.adoc#tensor_expression[Tensor Expression] + +[cols=",,",] +|=== +|Public base |`tensor_container` |`tensor_t` must be derived +from this public base type. + +|Storage array |`tensor_t::array_type` |Dense tensor ONLY. The type of +underlying storage array used to store the elements. The array_type must +model the link:storage_concept.adoc[*Storage*] concept. +|=== + +==== Notation + +[cols=",",] +|=== +|`tensor_t` |A type that is a model of Tensor + +|`t` |Objects of type `tensor_t` + +|`n1, n2, np, m1, m2, mq ` |Dimension objects of a type convertible to +`size_type` + +|`i1, i2, ip, j, k ` |Index objects of a type convertible to `size_type` + +|`v` |Object of a type convertible to `value_type` +|=== + +==== Definitions + +==== Valid expressions + +In addition to the expressions defined in +link:expression_concept.adoc#tensor_expression[Tensor Expression] the +following expressions must be valid. + +[cols=",,,",] +|=== +|Name |Expression |Type requirements |Return type + +|Sizing constructor |`T t(n1, n2, ..., np)` |  |`T` + +|Write |`t.at(i1, i2, ..., ip)` |`t` is mutable. |`void` + +|Read |`t.at(i1, i2, ..., ip)` |`t` is mutable. |`v` + +|Clear |`t.clear ()` |`t` is mutable. |`void` + +|Resize |`t.resize(m1, m2, ... , mq)` |`t` is mutable. |`void` + +|Storage |`t.data()` |`t` is mutable and dense. |`pointer` if `t` is +mutable, `const_pointer` otherwise +|=== + +==== Expression semantics + +Semantics of an expression is defined only where it differs from, or is +not defined in link:expression_concept.adoc#tensor_expression[Tensor +Expression] . + +[width="100%",cols=",,,,",options="header",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition + +|Sizing constructor |`T t(n1, n2, ..., np)` |`__n__~_r_~` > =1 for 1< = 1 < = p |Allocates a `p` -order tensor with dimension extents `__n__~_1_~, __n__~_2_~, .... __n__~_p_~`. |`t.size(r)==nr` for 1 < = r < = p. + +|Write |`t.at(i1,i2,...,ip)=v` |0 < = `__i__~_r_~` < `__n__~_r_~` for 1 < = r < = p. |Writes an element at multi-index position `__i__~_1_~, __i__~_2_~, ... __i__~_p_~` with value `v`. |`t(i1,i2,...,ip)` is equal to `v`. + +|Read |`v=t.at(i1,i2,...,ip)` |0 < = `__i__~_r_~` < `__n__~_r_~` for 1 < = r < = p. |Reads the element at multi-index position `__i__~_1_~, __i__~_2_~, ... __i__~_p_~` and returns a value `v`. |`t(i1,i2,...,ip)` is equal to `v`. + +|Clear |`t.clear()` | |Removes all elements from the container. | + +|Resize |`t.resize(m1, m2, ..., mq)` |`__m__~_r_~` > = 1 for 1 < = 1 < = q |Reallocate the matrix so that it can hold `__m__~_1_~ x __m__~_2_~ x ... __m__~_q_~` elements. + Erases or appends elements in order to bring the matrix to the prescribed size. Appended elements are `value_type()` copies. |`t.size(r) == mr` for 1 < = r < = q. + +|Storage |`m.data()` | |Returns a reference to the underlying dense storage.| | + +|=== + +==== Complexity guarantees + +The run-time complexity of contructor is linear in the tensor's size +`__n__~_1_~ x __n__~_2_~ x ... __n__~_p_~`. + +The run-time complexity of `write()` and `read()` is linear in the order +of the tensor. + +The run-time complexity of resize is at most linear in the tensor's size +`__m__~_1_~ x __m__~_2_~ x ... __n__~_q_~`. + +==== Invariants + +==== Models + +* `tensor` + +==== Notes + +[#tensor_expression_note]#[1]# As a user you need not care about Tensor +being a refinement of the TensorExpression. Being a refinement of the +TensorExpression is only important for the template-expression engine +but not the user. + +''''' + +Copyright (©) 2000-2002 Joerg Walter, Mathias Koch + +Copyright (©) 2018 Cem Bassoy + +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 ). diff --git a/doc/ublas/expression_concept.adoc b/doc/ublas/expression_concept.adoc new file mode 100644 index 000000000..3270e48ce --- /dev/null +++ b/doc/ublas/expression_concept.adoc @@ -0,0 +1,604 @@ +== Expression Concepts + +[[toc]] + +=== [#scalar_expression]#Scalar Expression# + +==== Description + +A Scalar Expression is an expression convertible to a scalar type. + +==== Refinement of + +Default Constructible. + +==== Associated types + +[cols=",,",] +|=== +|Public base |scaler_expression |S must be derived from this public +base type. + +|Value type |`value_type` |The type of the scalar expression. +|=== + +==== Notation + +[cols=",",] +|=== +|`S` |A type that is a model of Scalar Expression +|=== + +==== Definitions + +==== Valid expressions + +In addition to the expressions defined in Default Constructible the +following expressions must be valid. + +[cols=",,,",] +|=== +|Name |Expression |Type requirements |Return type +|Evaluation |`operator value_type () const` |  |`value_type` +|=== + +==== Expression semantics + +Semantics of an expression is defined only where it differs from, or is +not defined in Default Constructible. + +[cols=",,,,",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition + +|Evaluation |`operator value_type () const` |  |  Evaluates the scalar +expression. |  +|=== + +==== Complexity guarantees + +The run-time complexity of the evaluation is specific for the evaluated +scalar expression. + +==== Invariants + +==== Models + +* `vector_scalar_unary` +* `vector_scalar_binary` + +=== [#vector_expression]#Vector Expression# + +==== Description + +A Vector Expression is an expression evaluatable to a vector. Vector +Expression provides an +link:iterator_concept.html#indexed_bidirectional_iterator[Indexed +Bidirectional Iterator] or an +link:iterator_concept.html#indexed_random_access_iterator[Indexed Random +Access Iterator] . + +==== Refinement of + +Default Constructible. + +==== Associated types + +[width="100%",cols="34%,33%,33%",] +|=== +|Public base |vector_expression |V must be derived from this public +base type. + +|Value type |`value_type` |The element type of the vector expression. + +|Reference type |`reference` |The return type when accessing an element +of a vector expression. + +Convertable to a`value_type`. + +|Const reference type |`const_reference` |The return type when accessing +an element of a constant vector expression. + +Convertable to a`value_type`. + +|Size type |`size_type` |The index type of the vector expression. Am +unsigned integral type used to represent size and index values. + +Can represent any nonnegative value of `difference_type`. + +|Distance type |`difference_type` |A signed integral type used to +represent the distance between two of the vector expression's iterators. + +|Const iterator type |`const_iterator` |A type of iterator that may be +used to examine a vector expression's elements. + +|Iterator type |`iterator` |A type of iterator that may be used to +modify a vector expression's elements. + +|Const reverse iterator type |`const_reverse_iterator` |A Reverse +Iterator adaptor whose base iterator type is the vector expression's +const iterator type. + +|Reverse iterator type |`reverse_iterator` |A Reverse Iterator adaptor +whose base iterator type is the vector expression's iterator type. +|=== + +==== Notation + +[cols=",",] +|=== +|`V` |A type that is a model of Vector Expression +|`v, v1, v2` |Object of type `V` +|`i` |Object of a type convertible to `size_type` +|`t` |Object of a type convertible to `value_type` +|=== + +==== Definitions + +==== Valid expressions + +In addition to the expressions defined in Default Constructible the +following expressions must be valid. + +[cols=",,,",] +|=== +|Name |Expression |Type requirements |Return type + +|Beginning of range |`v.begin ()` |  |`const_iterator` + +| |`v.begin ()` |`v` is mutable. |`iterator` + +|End of range |`v.end ()` |  |`const_iterator` + +| |`v.end ()` |`v` is mutable. |`iterator` + +|Size |`v.size ()` |  |`size_type` + +|Swap |`v1.swap (v2)` |`v1` and `v2` are mutable. |`void` + +|Beginning of reverse range |`v.rbegin ()` |  |`const_reverse_iterator` + +| |`v.rbegin ()` |`v` is mutable. |`reverse_iterator` + +|End of reverse range |`v.rend ()` |  |`const_reverse_iterator` + +| |`v.rend ()` |`v` is mutable. |`reverse_iterator` + +|Element access |`v (i)` |`i` is convertible to `size_type`. +|Convertible to `value_type`. + +|Assignment |`v2 = v1` |`v2` is mutable and `v1` is convertible to `V`. +|`V &` + +| |`v2.assign (v1)` |`v2` is mutable and `v1` is convertible to `V`. +|`V &` + +|Computed assignment |`v2 += v1` |`v2` is mutable and `v1` is +convertible to `V`. |`V &` + +| |`v2.plus_assign (v1)` |`v2` is mutable and `v1` is convertible to +`V`. |`V &` + +| |`v2 -= v1` |`v2` is mutable and `v1` is convertible to `V`. |`V &` + +| |`v2.minus_assign (v1)` |`v2` is mutable and `v1` is convertible to +`V`. |`V &` + +| |`v *= t` |`v` is mutable and `t` is convertible to `value_type`. +|`V &` +|=== + +==== Expression semantics + +Semantics of an expression is defined only where it differs from, or is +not defined in Default Constructible. + +[cols=",,,,",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition + +|Beginning of range |`v.begin ()` |  |Returns an iterator pointing to +the first element in the vector expression. |`v.begin ()` is either +dereferenceable or past-the-end. It is past-the-end if and only if +`v.size () == 0`. + +|End of range |`v.end ()` |  |Returns an iterator pointing one past the +last element in the vector expression. |`v.end ()` is past-the-end. + +|Size |`v.size ()` |  |Returns the size of the vector expression, that +is, its number of elements. |`v.size () >= 0` + +|Swap |`v1.swap (v2)` |  |Equivalent to `swap (v1, v2)`. |  + +|Beginning of reverse range |`v.rbegin ()` |  |Equivalent to +`reverse_iterator (v.end ())`. |`v.rbegin ()` is either dereferenceable +or past-the-end. It is past-the-end if and only if `v.size () == 0`. + +|End of reverse range |`v.rend ()` |  |Equivalent to +`reverse_iterator (v.begin ())`. |`v.rend ()` is past-the-end. + +|Element access |`v (i)` |`0 <= i < v.size ()` |Returns the `i`-th +element of the vector expression. |  + +|Assignment |`v2 = v1` |`v1.size () == v2.size ()` |Assigns every +element of the evaluated vector expression `v1` to the corresponding +element of `v2` . |  + +| |`v2.assign (v1)` |`v1.size () == v2.size ()` |Assigns every element +of `v1` to the corresponding element of `v2`. |  + +|Computed assignment |`v2 += v1` |`v1.size () == v2.size ()` |Adds every +element of the evaluated vector expression `v1` to the corresponding +element of `v2`. |  + +| |`v2.plus_assign (v1)` |`v1.size () == v2.size ()` |Adds every element +of `v1` to the corresponding element of `v2`. |  + +| |`v2 -= v1` |`v1.size () == v2.size ()` |Subtracts every element of +the evaluated vector expression `v1` from the corresponding element of +`v2` . |  + +| |`v2.minus_assign (v1)` |`v1.size () == v2.size ()` |Subtracts every +element of `v1` from the corresponding element of `v2`. |  + +| |`v *= t` |  |Multiplies every element of `v` with `t` . |  +|=== + +==== Complexity guarantees + +The run-time complexity of `begin ()` and `end ()` is specific for the +evaluated vector expression, typically amortized constant time. + +The run-time complexity of `size ()` is constant time. + +The run-time complexity of `swap ()` is specific for the evaluated +vector expression, typically constant time. + +The run-time complexity of `rbegin ()` and `rend ()` is specific for the +evaluated vector expression, typically amortized constant time. + +The run-time complexity of the element access is specific for the +evaluated vector expression, typically amortized constant time for the +dense and logarithmic for the sparse case. + +The run-time complexity of the arithmetic operations is specific for the +evaluated vector expressions, typically linear in the size of the +expressions. + +==== Invariants + +[cols=",",] +|=== +|Valid range |For any vector expression `v`, `[v.begin (), v.end ())` is +a valid range. + +|Completeness |An algorithm that iterates through the range +`[v.begin (), v.end ())` will pass through every element of `v` . + +|Valid reverse range |`[v.rbegin (), v.rend ())` is a valid range. + +|Equivalence of ranges |The distance from `v.begin ()` to `v.end ()` is +the same as the distance from `v.rbegin ()` to `v.rend ()`. +|=== + +==== Models + +* `vector_range;` +* `vector_slice` +* `matrix_row` +* `matrix_column` +* `matrix_vector_range` +* `matrix_vector_slice` +* `vector_unary` +* `vector_binary` +* `vector_binary_scalar1` +* `vector_binary_scalar2` +* `matrix_vector_unary1` +* `matrix_vector_unary2` +* `matrix_vector_binary1` +* `matrix_vector_binary2` + +=== [#matrix_expression]#Matrix Expression# + +==== Description + +A Matrix Expression is an expression evaluatable to a matrix. Matrix +Expression provides an +link:iterator_concept.html#indexed_bidirectional_cr_iterator[Indexed +Bidirectional Column/Row Iterator] or an +link:iterator_concept.html#indexed_random_access_cr_iterator[Indexed +Random Access Column/Row Iterator] . + +==== Refinement of + +Default Constructible. + +==== Associated types + +===== immutable types + +[width="100%",cols="34%,33%,33%",] +|=== +|Public base |`matrix_expression` |M must be derived from this public +base type. + +|Value type |`value_type` |The element type of the matrix expression. + +|Const reference type |`const_reference` |The return type when accessing +an element of a constant matrix expression. + +Convertable to a `value_type`. + +|Size type |`size_type` |The index type of the matrix expression. Am +unsigned integral type used to represent size and index values. + +Can represent any nonnegative value of `difference_type`. + +|Distance type |`difference_type` |A signed integral type used to +represent the distance between two of the matrix expression's iterators. + +|Const iterator types |`const_iterator1` |A type of column iterator that +may be used to examine a matrix expression's elements. + +| |`const_iterator2` |A type of row iterator that may be used to examine +a matrix expression's elements. + +|Const reverse iterator types |`const_reverse_iterator1` |A Reverse +Iterator adaptor whose base iterator type is the matrix expression's +const column iterator type. + +| |`const_reverse_iterator2` |A Reverse Iterator adaptor whose base +iterator type is the matrix expression's const row iterator type. +|=== + +===== mutable types + +[width="100%",cols="34%,33%,33%",] +|=== +|Reference type |`reference` |The return type when accessing an element +of a matrix expression. + +Convertable to a `value_type`. + +|Iterator types |`iterator1` |A type of column iterator that may be used +to modify a matrix expression's elements. + +| |`iterator2` |A type of row iterator that may be used to modify a +matrix expression's elements. + +|Reverse iterator types |`reverse_iterator1` |A Reverse Iterator adaptor +whose base iterator type is the matrix expression's column iterator +type. + +| |`reverse_iterator2` |A Reverse Iterator adaptor whose base iterator +type is the matrix expression's row iterator type. +|=== + +==== Notation + +[cols=",",] +|=== +|`M` |A type that is a model of Matrix Expression +|`m, m1, m2` |Object of type `M` +|`i, j` |Objects of a type convertible to `size_type` +|`t` |Object of a type convertible to `value_type` +|=== + +==== Definitions + +==== Valid expressions + +In addition to the expressions defined in Default Constructible the +following expressions must be valid. + +===== immutable expressions + +[cols=",,,",options="header",] +|=== +|Name |Expression |Type requirements |Return type +|Size |`m.size1 ()` |  |`size_type` +| |`m.size2 ()` |  |`size_type` +|=== + +===== possibly mutable expressions + +[cols=",,,",] +|=== +|Name |Expression |Type requirements |Return type + +|Beginning of range |`m.begin1 ()` |  |`const_iterator1` + +| |`m.begin2 ()` |  |`const_iterator2` + +| |`m.begin1 ()` |`m` is mutable.  |`iterator1` + +| |`m.begin2 ()` |`m` is mutable. |`iterator2` + +|End of range |`m.end1 ()` |  |`const_iterator1` + +| |`m.end2 ()` |  |`const_iterator2` + +| |`m.end1 ()` |`m` is mutable.  |`iterator1` + +| |`m.end2 ()` |`m` is mutable. |`iterator2` + +|Swap |`m1.swap (m2)` |`m1` and `m2` are mutable.  |`void` + +|Beginning of reverse range |`m.rbegin1 ()` |  +|`const_reverse_iterator1` + +| |`m.rbegin2 ()` |  |`const_reverse_iterator2` + +| |`m.rbegin1 ()` |`m` is mutable.  |`reverse_iterator1` + +| |`m.rbegin2 ()` |`m` is mutable. |`reverse_iterator2` + +|End of reverse range |`m.rend1 ()` |  |`const_reverse_iterator1` + +| |`m.rend2 ()` |  |`const_reverse_iterator2` + +| |`m.rend1 ()` |`m` is mutable. |`reverse_iterator1` + +| |`m.rend2 ()` |`m` is mutable. |`reverse_iterator2` + +|Element access |`m (i, j)` |`i` and `j` are convertible to `size_type` +. |Convertible to `value_type`. + +|Assignment |`m2 = m1` |`m2` is mutable and `m1` is convertible to `M`. +|`M &` + +| |`m2.assign (m1)` |`m2` is mutable and `m1` is convertible to `M`. +|`M &` + +|Computed assignment |`m2 += m1` |`m2` is mutable and `m1` is +convertible to `M`. |`M &` + +| |`m2.plus_assign (m1)` |`m2` is mutable and `m1` is convertible to +`M`. |`M &` + +| |`m2 -= m1` |`m2` is mutable and `m1` is convertible to `M`. |`M &` + +| |`m2.minus_assign (m1)` |`m2` is mutable and `m1` is convertible to +`M`. |`M &` + +| |`m *= t` |`m` is mutable and `t` is convertible to `value_type`. +|`M &` +|=== + +==== Expression semantics + +Semantics of an expression is defined only where it differs from, or is +not defined in Default Constructible. + +[cols=",,,,",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition + +|Beginning of range |`m.begin1 ()` |  |Returns an iterator pointing to +the first element in the first column of a matrix expression. +|`m.begin1 ()` is either dereferenceable or past-the-end. It is +past-the-end if and only if `m.size1 () == 0`. + +| |`m.begin2 ()` |  |Returns an iterator pointing to the first element +in the first row of a matrix expression. |`m.begin2 ()` is either +dereferenceable or past-the-end. It is past-the-end if and only if +`m.size2 () == 0`. + +|End of range |`m.end1 ()` |  |Returns an iterator pointing one past the +last element in the matrix expression. |`m.end1 ()` is past-the-end. + +| |`m.end2 ()` |  |Returns an iterator pointing one past the last +element in the matrix expression. |`m.end2 ()` is past-the-end. + +|Size |`m.size1 ()` |  |Returns the number of rows of the matrix +expression. |`m.size1 () >= 0` + +| |`m.size2 ()` |  |Returns the number of columns of the matrix +expression. |`m.size2 () >= 0` + +|Swap |`m1.swap (m2)` |  |Equivalent to `swap (m1, m2)`. |  + +|Beginning of reverse range |`m.rbegin1 ()` |  |Equivalent to +`reverse_iterator1 (m.end1 ())`. |`m.rbegin1 ()` is either +dereferenceable or past-the-end. It is past-the-end if and only if +`m.size1 () == 0`. + +| |`m.rbegin2 ()` |  |Equivalent to `reverse_iterator2 (m.end2 ())`. +|`m.rbegin2 ()` is either dereferenceable or past-the-end. It is +past-the-end if and only if `m.size2 () == 0`. + +|End of reverse range |`m.rend1 ()` |  |Equivalent to +`reverse_iterator1 (m.begin1 ())`. |`m.rend1 ()` is past-the-end. + +| |`m.rend2 ()` |  |Equivalent to `reverse_iterator2 (m.begin2 ())`. +|`m.rend2 ()` is past-the-end. + +|Element access |`m (i, j)` |`0 <= i < m.size1 ()` and +`0 <= j < m.size2 ()` |Returns the `j`-th element of the `i`-th row of +the matrix expression. |  + +|Assignment |`m2 = m1` |`m1.size1 () == m2.size1 ()` and +` m1.size2 () == m2.size2 ()` |Assigns every element of the evaluated +matrix expression `m1` to the corresponding element of `m2` . |  + +| |`m2.assign (m1)` |`m1.size1 () == m2.size1 ()` and +` m1.size2 () == m2.size2 ()` |Assigns every element of `m1` to the +corresponding element of `m2`. |  + +|Computed assignment |`m2 += m1` |`m1.size1 () == m2.size1 ()` and +` m1.size2 () == m2.size2 ()` |Adds every element of the evaluated +matrix expression `m1` to the corresponding element of `m2`. |  + +| |`m2.plus_assign (m1)` |`m1.size1 () == m2.size1 ()` and +` m1.size2 () == m2.size2 ()` |Adds every element of `m1` to the +corresponding element of `m2`. |  + +| |`m2 -= m1` |`m1.size1 () == m2.size1 ()` and +` m1.size2 () == m2.size2 ()` |Subtracts every element of the evaluated +matrix expression `m1` from the corresponding element of `m2` . |  + +| |`m2.minus_assign (m1)` |`m1.size1 () == m2.size1 ()` and +` m1.size2 () == m2.size2 ()` |Subtracts every element of `m1` from the +corresponding element of `m2`. |  + +| |`m *= t` |  |Multiplies every element of `m` with `t` . |  +|=== + +==== Complexity guarantees + +The run-time complexity of `begin1 ()`, `begin2 ()` , `end1 ()` and +`end2 ()` is specific for the evaluated matrix expression. + +The run-time complexity of `size1 ()` and `size2 ()` is constant time. + +The run-time complexity of `swap ()` is specific for the evaluated +matrix expression, typically constant time. + +The run-time complexity of `rbegin1 ()`, `rbegin2 ()` , `rend1 ()` and +`rend2 ()` is specific for the evaluated matrix expression. + +The run-time complexity of the element access is specific for the +evaluated matrix expression, typically amortized constant time for the +dense and logarithmic for the sparse case. + +The run-time complexity of the arithmetic operations is specific for the +evaluated matrix expressions, typically quadratic in the size of the +proxies. + +==== Invariants + +[cols=",",] +|=== +|Valid range |For any matrix expression `m`, `[m.begin1 (), m.end1 ())` +and `[m.begin2 (), m.end2 ())` are valid ranges. + +|Completeness |An algorithm that iterates through the range +`[m.begin1 (), m.end1 ())` will pass through every row of `m` , an +algorithm that iterates through the range `[m.begin2 (), m.end2 ())` +will pass through every column of `m` . + +|Valid reverse range |`[m.rbegin1 (), m.rend1 ())` and +`[m.rbegin2 (), m.rend2 ())` are valid ranges. + +|Equivalence of ranges |The distance from `m.begin1 ()` to `m.end1 ()` +is the same as the distance from `m.rbegin1 ()` to `m.rend1 ()` and the +distance from `m.begin2 ()` to `m.end2 ()` is the same as the distance +from `m.rbegin2 ()` to `m.rend2 ()`. +|=== + +==== Models + +* `matrix_range` +* `matrix_slice;` +* `triangular_adaptor` +* `symmetric_adaptor` +* `banded_adaptor` +* `vector_matrix_binary` +* `matrix_unary1` +* `matrix_unary2` +* `matrix_binary` +* `matrix_binary_scalar1` +* `matrix_binary_scalar2` +* `matrix_matrix_binary` + +''''' + +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 ). diff --git a/doc/ublas/hermitian.adoc b/doc/ublas/hermitian.adoc new file mode 100644 index 000000000..4634816cd --- /dev/null +++ b/doc/ublas/hermitian.adoc @@ -0,0 +1,409 @@ +== Hermitian Matrix + +[[toc]] + +=== [#hermitian_matrix]#Hermitian Matrix# + +==== Description + +The templated class `hermitian_matrix` is the base +container adaptor for hermitian matrices. For a _(n x n_ )-dimensional +hermitian matrix and _0 < = i < n_, _0 < = j < n_ holds __h__~_i,j_~= +__h__~_j,i_~^_-_^. The storage of hermitian matrices is packed. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + hermitian_matrix, lower> ml (3, 3); + for (unsigned i = 0; i < ml.size1 (); ++ i) { + for (unsigned j = 0; j < i; ++ j) + ml (i, j) = std::complex (3 * i + j, 3 * i + j); + ml (i, i) = std::complex (4 * i, 0); + } + std::cout << ml << std::endl; + hermitian_matrix, upper> mu (3, 3); + for (unsigned i = 0; i < mu.size1 (); ++ i) { + mu (i, i) = std::complex (4 * i, 0); + for (unsigned j = i + 1; j < mu.size2 (); ++ j) + mu (i, j) = std::complex (3 * i + j, 3 * i + j); + } + std::cout << mu << std::endl; +} +.... + +==== Definition + +Defined in the header hermitian.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the matrix. | + +|`F1` |Functor describing the type of the hermitian matrix. +link:#hermitian_matrix_1[[1]] |`lower` + +|`F2` |Functor describing the storage organization. +link:#hermitian_matrix_2[[2]] |`row_major` + +|`A` |The type of the adapted array. link:#hermitian_matrix_3[[3]] +|`unbounded_array` +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|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 hermitian_matrix (const matrix_expression &ae)` +|The extended copy constructor. + +|`void resize (size_type size, bool preserve = true)` |Reallocates a +`hermitian_matrix` to hold `size` rows of `size` elements. The existing +elements of the `hermitian_matrix` are preseved when specified. + +|`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 hermitian_matrix &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template hermitian_matrix &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the hermitian matrix. Left and right +hand side of the assignment should be independent. + +|`template hermitian_matrix &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +hermitian matrix. + +|`template hermitian_matrix &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the hermitian matrix. Left and right hand +side of the assignment should be independent. + +|`template hermitian_matrix &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the hermitian matrix. + +|`template hermitian_matrix &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the hermitian matrix. Left and right +hand side of the assignment should be independent. + +|`template hermitian_matrix &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the hermitian matrix with a +scalar. + +|`template 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 + +[#hermitian_matrix_1]#[1]# Supported parameters for the type of the +hermitian matrix are `lower` and `upper`. + +[#hermitian_matrix_2]#[2]# Supported parameters for the storage +organization are `row_major` and `column_major`. + +[#hermitian_matrix_3]#[3]# Supported parameters for the adapted array +are `unbounded_array` , `bounded_array` and `std::vector` . + +=== [#hermitian_adaptor]#Hermitian Adaptor# + +==== Description + +The templated class `hermitian_adaptor` is a hermitian matrix +adaptor for other matrices. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix > m (3, 3); + hermitian_adaptor >, lower> hal (m); + for (unsigned i = 0; i < hal.size1 (); ++ i) { + for (unsigned j = 0; j < i; ++ j) + hal (i, j) = std::complex (3 * i + j, 3 * i + j); + hal (i, i) = std::complex (4 * i, 0); + } + std::cout << hal << std::endl; + hermitian_adaptor >, upper> hau (m); + for (unsigned i = 0; i < hau.size1 (); ++ i) { + hau (i, i) = std::complex (4 * i, 0); + for (unsigned j = i + 1; j < hau.size2 (); ++ j) + hau (i, j) = std::complex (3 * i + j, 3 * i + j); + } + std::cout << hau << std::endl; +} +.... + +==== Definition + +Defined in the header hermitian.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`M` |The type of the adapted matrix. | + +|`F` |Functor describing the type of the hermitian adaptor. +link:#hermitian_adaptor_1[[1]] |`lower` +|=== + +==== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +==== Public base classes + +`matrix_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`hermitian_adaptor (matrix_type &data)` |Constructs a +`hermitian_adaptor` of a matrix. + +|`hermitian_adaptor (const hermitian_adaptor &m)` |The copy constructor. + +|`template hermitian_adaptor (const matrix_expression &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 hermitian_adaptor &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template hermitian_adaptor &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the hermitian adaptor. Left and right +hand side of the assignment should be independent. + +|`template hermitian_adaptor &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +hermitian adaptor. + +|`template hermitian_adaptor &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the hermitian adaptor. Left and right hand +side of the assignment should be independent. + +|`template hermitian_adaptor &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the hermitian adaptor. + +|`template hermitian_adaptor &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the hermitian adaptor. Left and +right hand side of the assignment should be independent. + +|`template hermitian_adaptor &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the hermitian adaptor with a +scalar. + +|`template 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 + +[#hermitian_adaptor_1]#[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 ). diff --git a/doc/ublas/index.adoc b/doc/ublas/index.adoc new file mode 100644 index 000000000..be89ef3c8 --- /dev/null +++ b/doc/ublas/index.adoc @@ -0,0 +1,230 @@ +//// +Copyright 2021 Shikhar Vashistha +Copyright 2021 Cem Bassoy + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +//// + +# Boost.Ublas: The Boost Ublas Library +:toc: left +:toclevels: 2 +:idprefix: +:listing-caption: Code Example +:docinfo: private-footer + +== Basic Linear and Multilinear Algebra Library + +[[toc]] + +uBLAS is a C++ template class library that provides http://www.netlib.org/blas[BLAS] level 1, 2, 3 functionality for dense, packed and sparse matrices. +The design and implementation unify mathematical notation via operator overloading and efficient code generation via expression templates. +Since 2018, uBLAS also supports basic operations for multilinear algebra operations such as the outer and inner product of higher-order tensors. +The goal of the new tensor extension is to provide basic operations that simplify the implementation of e.g. machine learning and quantum computing algorithms. + + +=== Functionality + +uBLAS provides templated C++ classes for dense, unit and sparse vectors, dense, identity, triangular, banded, symmetric, hermitian and sparse matrices. +Views into vectors and matrices can be constructed via ranges, slices, adaptor classes and indirect arrays. +The library covers the usual basic linear and multilinear algebra operations on vectors, matrices and tensors: +reductions like different norms, addition and subtraction of vectors and matrices and multiplication with a scalar, inner and outer products of vectors, matrix vector and matrix matrix products and triangular solver. +Similar operations are also provided for the tensor type. +The glue between containers, views and expression templated operations is a mostly https://en.wikipedia.org/wiki/Standard_Template_Library[STL] conforming iterator interface. + + + +=== Documentation + +* link:overview.html[Overview] +** link:overview.html#rationale[Rationale] +** link:overview.html#functionality[Functionality] +** link:types_overview.html[Overview of Tensor, Matrix- and Vector +Types] +** link:operations_overview.html[Overview of Tensor, Matrix and Vector +Operations] +** link:#further_information[Effective uBLAS and further information] +** link:options.html[Macros and Preprocessor Options] +* link:vector.html[Vector] +** link:vector.html#vector[Vector] +** link:vector.html#unit_vector[Unit Vector] +** link:vector.html#zero_vector[Zero Vector] +** link:vector.html#scalar_vector[Scalar Vector] +* link:vector_sparse.html[Sparse Vector] +** link:vector_sparse.html#mapped_vector[Mapped Vector] +** link:vector_sparse.html#compressed_vector[Compressed Vector] +** link:vector_sparse.html#coordinate_vector[Coordinate Vector] +* link:vector_proxy.html[Vector Proxies] +** link:vector_proxy.html#vector_range[Vector Range] +** link:vector_proxy.html#vector_slice[Vector Slice] +* link:vector_expression.html[Vector Expressions] +** link:vector_expression.html#vector_expression[Vector Expression] +** link:vector_expression.html#vector_references[Vector References] +** link:vector_expression.html#vector_operations[Vector Operations] +** link:vector_expression.html#vector_reductions[Vector Reductions] +* link:matrix.html[Matrix] +** link:matrix.html#matrix[Matrix] +** link:matrix.html#identity_matrix[Identity Matrix] +** link:matrix.html#zero_matrix[Zero Matrix] +** link:matrix.html#scalar_matrix[Scalar Matrix] +* link:triangular.html[Triangular Matrix] +** link:triangular.html#triangular_matrix[Triangular Matrix] +** link:triangular.html#triangular_adaptor[Triangular Adaptor] +* link:symmetric.html[Symmetric Matrix] +** link:symmetric.html#symmetric_matrix[Symmetric Matrix] +** link:symmetric.html#symmetric_adaptor[Symmetric Adaptor] +* link:hermitian.html[Hermitian Matrix] +** link:hermitian.html#hermitian_matrix[Hermitian Matrix] +** link:hermitian.html#hermitian_adaptor[Hermitian Adaptor] +* link:banded.html[Banded Matrix] +** link:banded.html#banded_matrix[Banded Matrix] +** link:banded.html#banded_adaptor[Banded Adaptor] +* link:matrix_sparse.html[Sparse Matrix] +** link:matrix_sparse.html#mapped_matrix[Mapped Matrix] +** link:matrix_sparse.html#compressed_matrix[Compressed Matrix] +** link:matrix_sparse.html#coordinate_matrix[Coordinate Matrix] +* link:matrix_proxy.html[Matrix Proxies] +** link:matrix_proxy.html#matrix_row[Matrix Row] +** link:matrix_proxy.html#matrix_column[Matrix Column] +** link:matrix_proxy.html#vector_range[Vector Range] +** link:matrix_proxy.html#vector_slice[Vector Slice] +** link:matrix_proxy.html#matrix_range[Matrix Range] +** link:matrix_proxy.html#matrix_slice[Matrix Slice] +* link:matrix_expression.html[Matrix Expressions] +** link:matrix_expression.html#matrix_expression[Matrix Expression] +** link:matrix_expression.html#matrix_references[Matrix References] +** link:matrix_expression.html#matrix_operations[Matrix Operations] +** link:matrix_expression.html#matrix_vector_operations[Matrix Vector +Operations] +** link:matrix_expression.html#matrix_matrix_operations[Matrix Matrix +Operations] +* link:tensor.html[Tensor] +** link:tensor.html#tensor[Tensor] +* link:tensor/tensor_expression.html[Tensor Expressions] +** link:tensor/tensor_expression.html#tensor_expression[Tensor +Expression] +** link:tensor/tensor_expression.html#binary_tensor_expression[Binary +Tensor Expression] +** link:tensor/tensor_expression.html#unary_tensor_expression[Unary +Tensor Expression] +* Storage and special containers +** link:unbounded_array.html[Unbounded Array] +** link:bounded_array.html[Bounded Array] +** link:range.html#range[Range] +** link:range.html#slice[Slice] +** link:tensor/extents.html#extents[Extents] +** link:tensor/strides.html#strides[Strides] +* link:storage_sparse.html[Sparse Storage] +** link:storage_sparse.html#map_std[Default Standard Map] +** link:storage_sparse.html#map_array[Map Array] +* Operations & Functions +** link:products.html[Special Products] +** link:blas.html[BLAS] +* uBLAS Concept definitions +** link:container_concept.html[Container Concepts] +*** link:container_concept.html#vector[Vector] +*** link:container_concept.html#matrix[Matrix] +*** link:container_concept.html#tensor[Tensor] +** link:expression_concept.html[Expression Concepts] +*** link:expression_concept.html#scalar_expression[Scalar Expression] +*** link:expression_concept.html#vector_expression[Vector Expression] +*** link:expression_concept.html#matrix_expression[Matrix Expression] +** link:storage_concept.html[Storage Concept] +** link:iterator_concept.html[Iterator Concepts] +*** link:iterator_concept.html#indexed_bidirectional_iterator[Indexed +Bidirectional Iterator] +*** link:iterator_concept.html#indexed_random_access_iterator[Indexed +Random Access Iterator] +*** link:iterator_concept.html#indexed_bidirectional_cr_iterator[Indexed +Bidirectional Column/Row Iterator] +*** link:iterator_concept.html#indexed_random_access_cr_iterator[Indexed +Random Access Column/Row Iterator] + +=== Release notes + +Release notes can be found link:release_notes.html[here]. +[further_information] + +=== Known limitations + +* The implementation assumes a linear memory address model. +* Tuning was focussed on dense matrices. + +=== Further Information + +* https://lists.boost.org/mailman/listinfo.cgi/ublas[uBLAS mailing list] +* https://github.com/boostorg/ublas/wiki[uBLAS wiki] +* https://github.com/boostorg/ublas[Code] + +==== Authors and Credits + +uBLAS initially was written by Joerg Walter and Mathias Koch. +We would like thank all contributors who has supported this library. +Amongst many contributors around the world, David Abrahams, Ed Brey, Fernando Cacciola, Juan Jose Gomez Cadenas, Beman Dawes, Matt Davies, Bob Fletcher, Kresimir Fresl, Joachim Kessel, Patrick Kowalzick, Toon Knapen, Hendrik Kueck, John Maddock, Jens Maurer, Alexei Novakov, Gary Powell, Joachim Pyras, Peter Schmitteckert, Jeremy Siek, Markus Steffl, Michael Stevens, Benedikt Weber, Martin Weiser, Gunter Winkler, Marc Zimmermann, Marco Guazzone, Nasos Iliopoulus and the members of http://www.boost.org[Boost] had a great impact and contribution helping the library to grow and mature. + +Starting with the https://github.com/BoostGSoC18/tensor/wiki[GSoC 2018 project], uBlas has been extended by a flexible tensor data type and basic tensor operations supporting general tensor contractions and the Einstein notation. +The goal of the new tensor extension is to support the implementation of algorithms for e.g. machine learning and quantum computing applications. +The initial implementation of this extension is written by Cem Bassoy. +Contributors of the uBLAS extension are Amit Singh, Ashar Khan, Stefan Seefeld, Cem Bassoy and the members of http://www.boost.org[Boost]. + +This library is currently maintained by David Bellot, Cem Bassoy and Stefan Seefeld. + +=== Frequently Asked Questions + +Q: Should I use uBLAS for new projects? + +A: At the time of writing (09/2012) there are a lot of good matrix +libraries available, e.g., http://www.simunova.com[MTL4], +http://arma.sourceforge.net[armadillo], +http://eigen.tuxfamily.org[eigen]. uBLAS offers a stable, well tested +set of vector and matrix classes, the typical operations for linear +algebra and solvers for triangular systems of equations. uBLAS offers +dense, structured and sparse matrices - all using similar interfaces. +And finally uBLAS offers good (but not outstanding) performance. On the +other side, the last major improvement of uBLAS was in 2008 and no +significant change was committed since 2009. So one should ask himself +some questions to aid the decision: _Availability?_ uBLAS is part of +boost and thus available in many environments. _Easy to use?_ uBLAS is +easy to use for simple things, but needs decent C++ knowledge when you +leave the path. _Performance?_ There are faster alternatives. _Cutting +edge?_ uBLAS is more than 10 years old and missed all new stuff from +C++11. + +Q: I'm running the uBLAS dense vector and matrix benchmarks. Why do I +see a significant performance difference between the native C and +library implementations? + +A: uBLAS distinguishes debug mode (size and type conformance checks +enabled, expression templates disabled) and release mode (size and type +conformance checks disabled, expression templates enabled). Please +check, if the preprocessor symbol `NDEBUG` of `cassert` is defined. +`NDEBUG` enables release mode, which in turn uses expression templates. +You can optionally define `BOOST_UBLAS_NDEBUG` to disable all bounds, +structure and similar checks of uBLAS. + +Q: I've written some uBLAS tests, which try to incorrectly assign +different matrix types or overrun vector and matrix dimensions. Why +don't I get a compile time or runtime diagnostic? + +A: uBLAS distinguishes debug mode (size and type conformance checks +enabled, expression templates disabled) and release mode (size and type +conformance checks disabled, expression templates enabled). Please +check, if the preprocessor symbol `NDEBUG` of `cassert` is defined. +`NDEBUG` disables debug mode, which is needed to get size and type +conformance checks. + +Q: I've written some uBLAS benchmarks to measure the performance of +matrix chain multiplications like `prod (A, prod (B, C))` and see a +significant performance penalty due to the use of expression templates. +How can I disable expression templates? + +A: You do not need to disable expression templates. Please try +reintroducing temporaries using either `prod (A,` `matrix_type` +`(prod (B, C)))` or `prod (A, prod<``matrix_type` `> (B, C))`. + +''''' + +Copyright (©) 2000-2011 Joerg Walter, Mathias Koch, Gunter Winkler, +David Bellot + +Copyright (©) 2021 Shikhar Vashistha + +Copyright (©) 2021 Cem Bassoy + +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 ). + diff --git a/doc/ublas/iterator_concept.adoc b/doc/ublas/iterator_concept.adoc new file mode 100644 index 000000000..f89b4ba2e --- /dev/null +++ b/doc/ublas/iterator_concept.adoc @@ -0,0 +1,639 @@ +== Iterator Concepts + +[[toc]] + +An Iterator is a restricted pointer-like object pointing into a vector +or matrix container. + +=== [#indexed_bidirectional_iterator]#Indexed Bidirectional Iterator# + +==== Description + +An Indexed Bidirectional Iterator is an iterator of a container that can +be dereferenced, incremented, decremented and carries index information. + +==== Refinement of + +Assignable, Equality Comparable, Default Constructible. + +==== Associated types + +[cols=",",] +|=== +|Value type |The type of the value obtained by dereferencing a Indexed +Bidirectional Iterator + +|Container type |The type of the container a Indexed Bidirectional +Iterator points into. +|=== + +==== Notation + +[cols=",",] +|=== +|`I` |A type that is a model of Indexed Bidirectional Iterator +|`T` |The value type of `I` +|`C` |The container type of `I` +|`it`, `itt, it1`, `it2` |Objects of type `I` +|`t` |Object of type `T` +|`c` |Object of type `C` +|=== + +==== Definitions + +A Indexed Bidirectional Iterator may be _mutable_, meaning that the +values referred to by objects of that type may be modified, or +_constant_ , meaning that they may not. If an iterator type is mutable, +this implies that its value type is a model of Assignable; the converse, +though, is not necessarily true. + +A Indexed Bidirectional Iterator may have a _singular_ value, meaning +that the results of most operations, including comparison for equality, +are undefined. The only operation that is guaranteed to be supported is +assigning a nonsingular iterator to a singular iterator. + +A Indexed Bidirectional Iterator may have a _dereferenceable_ value, +meaning that dereferencing it yields a well-defined value. +Dereferenceable iterators are always nonsingular, but the converse is +not true. + +An Indexed Bidirectional Iterator is _past-the-end_ if it points beyond +the last element of a container. Past-the-end values are nonsingular and +nondereferenceable. + +==== Valid expressions + +In addition to the expressions defined for Assignable, Equality +Comparable and Default Constructible, the following expressions must be +valid. + +[cols=",,,",] +|=== +|Name |Expression |Type requirements |Return type +|Default constructor |`I it` |  |  +|Dereference |`*it` |  |Convertible to `T`. +|Dereference assignment |`*it = t` |`I` is mutable. |  +|Member access |`it->m` |`T` is a type for which `t.m` is defined. |  +|Preincrement |`++ it` |  |`I &` +|Postincrement |`it ++` |  |`I` +|Predecrement |`-- it` |  |`I &` +|Postdecrement |`it --` |  |`I` +|Index |`it.index ()` |  |`C::size_type` +|=== + +==== Expression Semantics + +Semantics of an expression is defined only where it differs from, or is +not defined in, Assignable, Equality Comparable and Default +Constructible. + +[width="100%",cols="20%,20%,20%,20%,20%",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition + +|Default constructor |`I it` |  |  |`it` is singular. + +|Dereference |`*it` |`it` is dereferenceable. |  |  + +|Dereference assignment |`*it = t` |Same as for `*it`. |  |`*it` is a +copy of t. + +|Member access |`it->m` |`it` is dereferenceable. |Equivalent to +`(*it).m` |  + +|Preincrement |`++ it` |`it` is dereferenceable. |`it` is modified to +point to the next element. |`it` is dereferenceable or past-the-end. +` &it == &++ it`. + +If `it1 == it2`, + +then `++ it1 == ++ it2`. + +|Postincrement |`it ++` |Same as for `++ it`. |Equivalent to + +`{  I itt = it;  ++ it;  return itt; }` |`it` is dereferenceable or +past-the-end. + +|Predecrement |`-- it` |`it` is dereferenceable or past-the-end. + +There exists a dereferenceable iterator `itt` such that `it == ++ itt`. +|`it` is modified to point to the previous element. |`it` is +dereferenceable. + +`&it = &-- it`. + +If `it1 == it2`, + +then `-- it1 == -- it2`. + +If `it2` is dereferenceable and `it1 == ++it2`, + +then `--it1 == it2`. + +|Postdecrement |`it --` |Same as for -- `it`. |Equivalent to + +`{  I itt = it;  -- it;  return itt; }` |`it` is dereferenceable.  + +|Index |`it.index ()` |`it` is dereferenceable. |`it.index () >= 0` + +and + +`it.index () < it ().size ()` |If `it1 == it2`, + +then `it1.index () == it2.index ()`. + +If `it1 == it2`, + +then `it1.index () < (++ it2).index ()`. + +If `it1 == it2`, + +then `it1.index () > (-- it2).index ()`. +|=== + +==== Complexity guarantees + +The complexity of operations on indexed bidirectional iterators is +guaranteed to be amortized constant time. + +==== Invariants + +[cols=",",] +|=== +|Identity |`it1 == it2` if and only if `&*it1 == &*it2`. + +|Symmetry of increment and decrement |If `it` is dereferenceable, then +`++ it; --it;` is a null operation. Similarly, `-- it; ++ it;` is a null +operation. + +|Relation between iterator index and container element operator |If `it` +is dereferenceable, `*it == it () (it.index ())`. +|=== + +==== Models + +* `sparse_vector::iterator` + +=== [#indexed_random_access_iterator]#Indexed Random Access Iterator# + +==== Description + +An Indexed Random Access Iterator is an iterator of a container that can +be dereferenced, moved forward, moved backward and carries index +information. + +==== Refinement of + +LessThanComparable, link:#indexed_bidirectional_iterator[Indexed +Bidirectional Iterator] . + +==== Associated types + +[cols=",",] +|=== +|Value type |The type of the value obtained by dereferencing a Indexed +Random Access Iterator + +|Container type |The type of the container a Indexed Random Access +Iterator points into. +|=== + +==== Notation + +[cols=",",] +|=== +|`I` |A type that is a model of Indexed Random Access Iterator +|`T` |The value type of `I` +|`C` |The container type of `I` +|`it`, `itt, it1`, `it2` |Objects of type `I` +|`t` |Object of type `T` +|`n` |Object of type `C::difference_type` +|=== + +==== Definitions + +An Indexed Random Access Iterator `it1` is _reachable_ from an Indexed +Random Access Iterator `it2` if, after applying `operator ++` to `it2` a +finite number of times, `it1 == it2`. + +==== Valid expressions + +In addition to the expressions defined for +link:#indexed_bidirectional_iterator[Indexed Bidirectional Iterator] , +the following expressions must be valid. + +[cols=",,,",] +|=== +|Name |Expression |Type requirements |Return type +|Forward motion |`it += n` |  |`I &` +|Iterator addition |`it + n` |  |`I` +|Backward motion |`i -= n` |  |`I &` +|Iterator subtraction |`it - n` |  |`I`  +|Difference |`it1 - it2` |  |`C::difference_type` +|Element operator |`it [n]` |  |Convertible to `T`. +|Element assignment |`it [n] = t` |`I` is mutable |Convertible to `T`. +|=== + +==== Expression Semantics + +Semantics of an expression is defined only where it differs from, or is +not defined in, link:#indexed_bidirectional_iterator[Indexed +Bidirectional Iterator] . + +[width="100%",cols="20%,20%,20%,20%,20%",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition + +|Forward motion |`it += n` |Including `it` itself, there must be `n` +dereferenceable or past-the-end iterators following or preceding `it`, +depending on whether `n` is positive or negative. |If `n > 0`, +equivalent to executing `++ it` `n` times. If `n < 0`, equivalent to +executing `-- it` `n` times. If `n == 0`, this is a null operation. +|`it` is dereferenceable or past-the-end. + +|Iterator addition |`it + n` |Same as for `i += n`. |Equivalent to + +`{  I itt = it;  return itt += n; }` |Result is dereferenceable or +past-the-end. + +|Backward motion |`it -= n` |Including `it` itself, there must be `n` +dereferenceable or past-the-end iterators preceding or following `it`, +depending on whether `n` is positive or negative. |Equivalent to +`it += (-n)`. |`it` is dereferenceable or past-the-end. + +|Iterator subtraction |`it - n` |Same as for `i -= n`. |Equivalent to + +`{  I itt = it;  return itt -= n; }` |Result is dereferenceable or +past-the-end. + +|Difference |`it1 - it2` |Either `it1` is reachable from `it2` or `it2` +is reachable from `it1`, or both. |Returns a number `n` such that +`it1 == it2 + n` |  + +|Element operator |`it [n]` |`it + n` exists and is dereferenceable. +|Equivalent to `*(it + n)` |  + +|Element assignment |`i[n] = t` |Same as for `it [n]`. |Equivalent to +`*(it + n) = t` |  +|=== + +==== Complexity guarantees + +The complexity of operations on indexed random access iterators is +guaranteed to be amortized constant time. + +==== Invariants + +[cols=",",] +|=== +|Symmetry of addition and subtraction |If `it + n` is well-defined, then +`it += n; it -= n;` and `(it + n) - n` are null operations. Similarly, +if `it - n` is well-defined, then `it -= n; it += n;` and `(it - n) + n` +are null operations. + +|Relation between distance and addition |If `it1 - it2` is well-defined, +then `it1 == it2 + (it1 - it2)`. + +|Reachability and distance |If `it1` is reachable from `it2`, then +`it1 - it2 >= 0`. +|=== + +==== Models + +* `vector::iterator` + +=== [#indexed_bidirectional_cr_iterator]#Indexed Bidirectional Column/Row Iterator# + +==== Description + +An Indexed Bidirectional Column/Row Iterator is an iterator of a +container that can be dereferenced, incremented, decremented and carries +index information. + +==== Refinement of + +Assignable, Equality Comparable, Default Constructible. + +==== Associated types + +[cols=",",] +|=== +|Value type |The type of the value obtained by dereferencing a Indexed +Bidirectional Column/Row Iterator + +|Container type |The type of the container a Indexed Bidirectional +Column/Row Iterator points into. +|=== + +==== Notation + +[cols=",",] +|=== +|`I1` |A type that is a model of Indexed Bidirectional Column/Row +Iterator + +|`I2` |A type that is a model of Indexed Bidirectional Row/Column +Iterator + +|`T` |The value type of `I1` and `I2` + +|`C` |The container type of `I1` and `I2` + +|`it1`, `it1t, it11`, `it12` |Objects of type `I1` + +|`it2`, `it2t` |Objects of type `I2` + +|`t` |Object of type `T` + +|`c` |Object of type `C` +|=== + +==== Definitions + +==== Valid expressions + +In addition to the expressions defined for Assignable, Equality +Comparable and Default Constructible, the following expressions must be +valid. + +[cols=",,,",] +|=== +|Name |Expression |Type requirements |Return type +|Default constructor |`I1 it` |  |  +|Dereference |`*it` |  |Convertible to `T`. +|Dereference assignment |`*it = t` |`I1` is mutable. |  +|Member access |`it->m` |`T` is a type for which `t.m` is defined. |  +|Preincrement |`++ it` |  |`I1 &` +|Postincrement |`it ++` |  |`I1` +|Predecrement |`-- it` |  |`I1 &` +|Postdecrement |`it --` |  |`I1` +|Row Index |`it.index1 ()` |  |`C::size_type` +|Column Index |`it.index2 ()` |  |`C::size_type` +|Row/Column Begin |`it.begin ()` |  |`I2` +|Row/Column End |`it.end ()` |  |`I2` +|Reverse Row/Column Begin |`it.rbegin ()` |  |`reverse_iterator` +|Reverse Row/Column End |`it.rend ()` |  |`reverse_iterator` +|=== + +==== Expression Semantics + +Semantics of an expression is defined only where it differs from, or is +not defined in, Assignable, Equality Comparable and Default +Constructible. + +[width="100%",cols="20%,20%,20%,20%,20%",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition + +|Default constructor |`I1 it` |  |  |`it` is singular. + +|Dereference |`*it` |`it` is dereferenceable. |  |  + +|Dereference assignment |`*it = t` |Same as for `*it`. |  |`*it` is a +copy of t. + +|Member access |`it->m` |`it` is dereferenceable. |Equivalent to +`(*it).m` |  + +|Preincrement |`++ it` |`it` is dereferenceable. |`it` is modified to +point to the next element of the column/row, i.e. for column iterators +holds + +`it.index1 () < (++ it).index1 ()` and + +`it.index2 () == (++ it).index2 ()`, + +for row iterators holds + +`it.index1 () == (++ it).index1 ()` and + +`it.index2 () < (++ it).index2 ()`. + |`it` is dereferenceable or +past-the-end. ` &it == &++ it`. + +If `it1 == it2`, + +then `++ it1 == ++ it2`. + +|Postincrement |`it ++` |Same as for `++ it`. |Equivalent to + +`{  I1 itt = it;  ++ it;  return itt; }` |`it` is dereferenceable or +past-the-end. + +|Predecrement |`-- it` |`it` is dereferenceable or past-the-end. + +There exists a dereferenceable iterator `itt` such that `it == ++ itt`. +|`it` is modified to point to the previous  element of the column/row, +i.e. for column iterators holds + +`it.index1 () > (-- it).index1 ()` and + +`it.index2 () == (-- it).index2 ()`, + +for row iterators holds + +`it.index1 () == (-- it).index1 ()` and + +`it.index2 () > (-- it).index2 ()`. |`it` is dereferenceable. + +`&it = &-- it`. + +If `it1 == it2`, + +then `-- it1 == -- it2`. + +|Postdecrement |`it --` |Same as for -- `it`. |Equivalent to + +`{  I1 itt = it;  -- it;  return itt; }` |`it` is dereferenceable.  + +|Row Index |`it.index1 ()` |If `it` is a Row iterator then `it` must be +dereferenceable. |`it.index1 () >= 0` and + +`it.index1 () < it () .size1 ()` |If `it1 == it2`, + +then `it1.index1 () == 12.index1 ()`. + +If `it1`, `it2` are Row Iterators with `it1 == it2`, + +then `it1.index1 () < (++ it2`).`index1 ()`. + +and `it1.index1 () > (-- it2`).`index1 ()`. + +|Column Index |`it.index2 ()` |If `it` is a Column iterator then `it` +must be dereferenceable. |`it.index2 () >= 0` and + +`it.index2 () < it () .size2 ()` |If `it1 == it2`, + +then `it1.index2 () == it2`.`index2 ()` . + +If `it1`, `it2` are Column Iterators with `it1 == i12`, + +then `it1.index2 () < (++ it2`).`index2 ()`. + +end `it1.index2 () > (-- it2`).`index2 ()`. + +|Row/Column Begin |`it.begin ()` |`it` is dereferenceable. a| +If `it` is a Column Iterator, + +then `it2 = it.begin ()` is a Row Iterator + +with `it2.index1 () == it.index1 ()`. + +If `it` is a Row Iterator, + +then `it2 = it.begin ()` is a Column Iterator + +with `it2.index2 () == it.index2 ()`. + +|  + +|Row/Column End |`it.end ()` |`it` is dereferenceable. a| +If `it` is a Column Iterator, + +then `it2 = it.end ()` is a Row Iterator + +with `it2.index1 () == it.index1 ()`. + +If `it` is a Row Iterator, + +then `it2 = it.end ()` is a Column Iterator + +with `it2.index2 () == it.index2 ()`. + +|  + +|Reverse Row/Column Begin |`it.rbegin ()` |`it` is dereferenceable. +|Equivalent to `reverse_iterator (it.end ())`. |  + +|Reverse Row/Column End |`it.rend ()` |`it` is dereferenceable. +|Equivalent to `reverse_iterator (it.begin ())`. |  +|=== + +==== Complexity guarantees + +The complexity of operations on indexed bidirectional column/row +iterators is guaranteed to be logarithmic depending on the size of the +container. The complexity of one iterator (depending on the storage +layout) can be lifted to be amortized constant time. The complexity of +the other iterator (depending on the storage layout and the container) +can be lifted to be amortized constant time for the first row/first +column respectively. + +==== Invariants + +[width="100%",cols="50%,50%",] +|=== +|Identity |`it1 == it2` if and only if `&*it1 == &*it2`. + +|Symmetry of increment and decrement |If `it` is dereferenceable, then +`++ it; --it;` is a null operation. Similarly, `-- it; ++ it;` is a null +operation. + +|Relation between iterator index and container element operator |If `it` +is dereferenceable, `*it == it () (it.index1 (), it.index2 ())` + +|Relation between iterator column/row begin and iterator index a| +If `it` is a Column Iterator and `it2 = it.begin ()` then +`it2.index2 () < it2t.index2 ()` for all `it2t` with `it2t () == it2 ()` +and `it2t ().index1 () == it2 ().index1 ()`. + +If `it` is a Row Iterator and `it2 = it.begin ()` then +`it2.index1 () < it2t.index1 ()` for all `it2t` with `it2t () == it2 ()` +and `it2t ().index2 () == it2 ().index2 ()`. + +|Relation between iterator column/row end and iterator index a| +If `it` is a Column Iterator and `it2 = it.end ()` then +`it2.index2 () > it2t.index2 ()` for all `it2t` with `it2t () == it2 ()` +and `it2t ().index1 () == it2 ().index1 ()`. + +If `it` is a Row Iterator and `it2 = it.end ()` then +`it2.index1 () > it2t.index1 ()` for all `it2t` with `it2t () == it2 ()` +and `it2t ().index2 () == it2 ().index2 ()`. + +|=== + +==== Models + +* `sparse_matrix::iterator1` +* `sparse_matrix::iterator2` + +=== [#indexed_random_access_cr_iterator]#Indexed Random Access Column/Row Iterator# + +==== Description + +An Indexed Random Access Column/Row Iterator is an iterator of a +container that can be dereferenced, incremented, decremented and carries +index information. + +==== Refinement of + +link:#indexed_bidirectional_cr_iterator[Indexed Bidirectional Column/Row +Iterator] . + +==== Associated types + +[cols=",",] +|=== +|Value type |The type of the value obtained by dereferencing a Indexed +Random Access Column/Row Iterator + +|Container type |The type of the container a Indexed Random Access +Column/Row Iterator points into. +|=== + +==== Notation + +[cols=",",] +|=== +|`I` |A type that is a model of Indexed Random Access Column/Row +Iterator + +|`T` |The value type of `I` + +|`C` |The container type of `I` + +|`it`, `itt, it1`, `it2` |Objects of type `I` + +|`t` |Object of type `T` + +|`c` |Object of type `C` +|=== + +==== Definitions + +==== Valid expressions + +In addition to the expressions defined for +link:#indexed_bidirectional_cr_iterator[Indexed Bidirectional Column/Row +Iterator] , the following expressions must be valid. + +[cols=",,,",] +|=== +|Name |Expression |Type requirements |Return type +|Forward motion |`it += n` |  |`I &` +|Iterator addition |`it + n` |  |`I` +|Backward motion |`i -= n` |  |`I &` +|Iterator subtraction |`it - n` |  |`I`  +|Difference |`it1 - it2` |  |`C::difference_type` +|Element operator |`it [n]` |  |Convertible to `T`. +|Element assignment |`it [n] = t` |`I` is mutable |Convertible to `T`. +|=== + +==== Expression Semantics + +Semantics of an expression is defined only where it differs from, or is +not defined in, link:#indexed_bidirectional_cr_iterator[Indexed +Bidirectional Column/Row Iterator] . + +[width="100%",cols="20%,20%,20%,20%,20%",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition + +|Forward motion |`it += n` |Including `it` itself, there must be `n` +dereferenceable or past-the-end iterators following or preceding `it`, +depending on whether `n` is positive or negative. |If `n > 0`, +equivalent to executing `++ it` `n` times. If `n < 0`, equivalent to +executing `-- it` `n` times. If `n == 0`, this is a null operation. +|`it` is dereferenceable or past-the-end. + +|Iterator addition |`it + n` |Same as for `i += n`. |Equivalent to + +`{  I itt = it;  return itt += n; }` |Result is dereferenceable or +past-the-end. + +|Backward motion |`it -= n` |Including `it` itself, there must be `n` +dereferenceable or past-the-end iterators preceding or following `it`, +depending on whether `n` is positive or negative. |Equivalent to +`it += (-n)`. |`it` is dereferenceable or past-the-end. + +|Iterator subtraction |`it - n` |Same as for `i -= n`. |Equivalent to + +`{  I itt = it;  return itt -= n; }` |Result is dereferenceable or +past-the-end. + +|Difference |`it1 - it2` |Either `it1` is reachable from `it2` or `it2` +is reachable from `it1`, or both. |Returns a number `n` such that +`it1 == it2 + n` |  + +|Element operator |`it [n]` |`it + n` exists and is dereferenceable. +|Equivalent to `*(it + n)` |  + +|Element assignment |`i[n] = t` |Same as for `it [n]`. |Equivalent to +`*(it + n) = t` |  +|=== + +==== Complexity guarantees + +The complexity of operations on indexed random access Column/Row +iterators is guaranteed to be amortized constant time. + +==== Invariants + +[cols=",",] +|=== +|Symmetry of addition and subtraction |If `it + n` is well-defined, then +`it += n; it -= n;` and `(it + n) - n` are null operations. Similarly, +if `it - n` is well-defined, then `it -= n; it += n;` and `(it - n) + n` +are null operations. + +|Relation between distance and addition |If `it1 - it2` is well-defined, +then `it1 == it2 + (it1 - it2)`. + +|Reachability and distance |If `it1` is reachable from `it2`, then +`it1 - it2 >= 0`. +|=== + +==== Models + +* `matrix::iterator1` +* `matrix::iterator2` + +''''' + +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 ). diff --git a/doc/ublas/matrix.adoc b/doc/ublas/matrix.adoc new file mode 100644 index 000000000..e369e4b5d --- /dev/null +++ b/doc/ublas/matrix.adoc @@ -0,0 +1,552 @@ +== Matrix + +[[toc]] + +=== [#matrix]#Matrix# + +==== Description + +The templated class `matrix` is the base container adaptor for +dense matrices. For a _(m x n_)-dimensional matrix and _0 <= i < m_, _0 +<= j < n_ every element __m__~_i,j_~ is mapped to the __(i x n +j)-__th element of the container for row major orientation or the __(i+ +j x m)-__th element of the container for column major orientation. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + for (unsigned i = 0; i < m.size1 (); ++ i) + for (unsigned j = 0; j < m.size2 (); ++ j) + m (i, j) = 3 * i + j; + std::cout << m << std::endl; +} +.... + +==== Definition + +Defined in the header matrix.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the matrix. | + +|`F` |Functor describing the storage organization. link:#matrix_1[[1]] +|`row_major` + +|`A` |The type of the link:storage_concept.html[Storage] array. +link:#matrix_2[[2]] |`unbounded_array` +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix ()` |Allocates an uninitialized `matrix` that holds zero rows +of zero elements. + +|`matrix (size_type size1, size_type size2)` |Allocates an uninitialized +`matrix` that holds `size1` rows of `size2` elements. + +|`matrix (const matrix &m)` |The copy constructor. + +|`template matrix (const matrix_expression &ae)` |The +extended copy constructor. + +|`void resize (size_type size1, size_type size2, bool preserve = true)` +|Reallocates a `matrix` to hold `size1` rows of `size2` elements. The +existing elements of the `matrix` are preseved when specified. + +|`size_type size1 () const` |Returns the number of rows. + +|`size_type size2 () const` |Returns the number of columns. + +|`const array_type& data () const` | + +|`array_type& data ()` | + +|`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. + +|`matrix &operator = (const matrix &m)` |The assignment operator. + +|`matrix &assign_temporary (matrix &m)` |Assigns a temporary. May change +the matrix `m`. + +|`template matrix &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template matrix &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the matrix. Left and right hand side of +the assignment should be independent. + +|`template matrix &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +matrix. + +|`template matrix &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the matrix. Left and right hand side of the +assignment should be independent. + +|`template matrix &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the matrix. + +|`template matrix &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the matrix. Left and right hand side +of the assignment should be independent. + +|`template matrix &operator *= (const AT &at)` |A computed +assignment operator. Multiplies the matrix with a scalar. + +|`template matrix &operator /= (const AT &at)` |A computed +assignment operator. Divides the matrix through a scalar. + +|`void swap (matrix &m)` |Swaps the contents of the matrices. + +|`void insert_element (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_element (size_type i, size_type j)` |Erases the value at +the `j`-th element of the `i`-th row. + +|`void clear ()` |Clears the matrix. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `matrix`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `matrix`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `matrix`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`matrix`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `matrix`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `matrix`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `matrix`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`matrix`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`matrix`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed `matrix`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `matrix`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `matrix`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`matrix`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed `matrix`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `matrix`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `matrix`. +|=== + +==== Notes + +[#matrix_1]#[1]# Supported parameters for the storage organization are +`row_major` and `column_major`. + +[#matrix_2]#[2]# Common parameters for the storage array are +`unbounded_array` , `bounded_array` and `std::vector` . + +=== [#identity_matrix]#Identity Matrix# + +==== Description + +The templated class `identity_matrix` represents identity +matrices. For a _(m x n_)-dimensional identity matrix and _0 <= i < m_, +_0 <= j < n_ holds __id__~_i,j_~ = 0, if _i <> j_, and __id__~_i,i_~ . + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + identity_matrix m (3); + std::cout << m << std::endl; +} +.... + +==== Definition + +Defined in the header matrix.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the matrix. |`int` + +|`ALLOC` |An STL Allocator for size_type and difference_type. +|std::allocator +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`identity_matrix ()` |Constructs an `identity_matrix` that holds zero +rows of zero elements. + +|`identity_matrix (size_type size)` |Constructs an `identity_matrix` +that holds `size` rows of `size` elements. + +|`identity_matrix (const identity_matrix &m)` |The copy constructor. + +|`void resize (size_type size, bool preserve = true)` |Resizes a +`identity_matrix` to hold `size` rows of `size` elements. Therefore the +existing elements of the `itendity_matrix` are always preseved. + +|`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 +the value of the `j`-th element in the `i`-th row. + +|`identity_matrix &operator = (const identity_matrix &m)` |The +assignment operator. + +|`identity_matrix &assign_temporary (identity_matrix &m)` |Assigns a +temporary. May change the identity matrix `m` . + +|`void swap (identity_matrix &m)` |Swaps the contents of the identity +matrices. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `identity_matrix`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `identity_matrix`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `identity_matrix`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `identity_matrix`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`identity_matrix`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`identity_matrix`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`identity_matrix`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`identity_matrix`. +|=== + +=== [#zero_matrix]#Zero Matrix# + +==== Description + +The templated class `zero_matrix` represents zero matrices. +For a _(m x n_)-dimensional zero matrix and _0 <= i < m_, _0 <= j < n_ +holds __z__~_i,j_~ = 0. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + zero_matrix m (3, 3); + std::cout << m << std::endl; +} +.... + +==== Definition + +Defined in the header matrix.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the matrix. |`int` + +|`ALLOC` |An STL Allocator for size_type and difference_type. +|std::allocator +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`zero_matrix ()` |Constructs a `zero_matrix` that holds zero rows of +zero elements. + +|`zero_matrix (size_type size1, size_type size2)` |Constructs a +`zero_matrix` that holds `size1` rows of `size2` elements. + +|`zero_matrix (const zero_matrix &m)` |The copy constructor. + +|`void resize (size_type size1, size_type size2, bool preserve = true)` +|Resizes a `zero_matrix` to hold `size1` rows of `size2` elements. +Therefore the existing elements of the `zero_matrix` are always +preseved. + +|`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 +the value of the `j`-th element in the `i`-th row. + +|`zero_matrix &operator = (const zero_matrix &m)` |The assignment +operator. + +|`zero_matrix &assign_temporary (zero_matrix &m)` |Assigns a temporary. +May change the zero matrix `m` . + +|`void swap (zero_matrix &m)` |Swaps the contents of the zero matrices. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `zero_matrix`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `zero_matrix`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `zero_matrix`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `zero_matrix`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`zero_matrix`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`zero_matrix`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`zero_matrix`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`zero_matrix`. +|=== + +=== [#scalar_matrix]#Scalar Matrix# + +==== Description + +The templated class `scalar_matrix` represents scalar +matrices. For a _(m x n_)-dimensional scalar matrix and _0 <= i < m_, _0 +<= j < n_ holds __z__~_i,j_~ = s. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + scalar_matrix m (3, 3); + std::cout << m << std::endl; +} +.... + +==== Definition + +Defined in the header matrix.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the matrix. |`int` + +|`ALLOC` |An STL Allocator for size_type and difference_type. +|std::allocator +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`scalar_matrix ()` |Constructs a `scalar_matrix` that holds scalar rows +of zero elements. + +|`scalar_matrix (size_type size1, size_type size2, const value_type &value)` +|Constructs a `scalar_matrix` that holds `size1` rows of `size2` +elements each of the specified value. + +|`scalar_matrix (const scalar_matrix &m)` |The copy constructor. + +|`void resize (size_type size1, size_type size2, bool preserve = true)` +|Resizes a `scalar_matrix` to hold `size1` rows of `size2` elements. +Therefore the existing elements of the `scalar_matrix` are always +preseved. + +|`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 +the value of the `j`-th element in the `i`-th row. + +|`scalar_matrix &operator = (const scalar_matrix &m)` |The assignment +operator. + +|`scalar_matrix &assign_temporary (scalar_matrix &m)` |Assigns a +temporary. May change the scalar matrix `m` . + +|`void swap (scalar_matrix &m)` |Swaps the contents of the scalar +matrices. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `scalar_matrix`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `scalar_matrix`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `scalar_matrix`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `scalar_matrix`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`scalar_matrix`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`scalar_matrix`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`scalar_matrix`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`scalar_matrix`. +|=== + +''''' + +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 ). diff --git a/doc/ublas/matrix_expression.adoc b/doc/ublas/matrix_expression.adoc new file mode 100644 index 000000000..942100d65 --- /dev/null +++ b/doc/ublas/matrix_expression.adoc @@ -0,0 +1,1313 @@ +== Matrix Expressions + +[[toc]] + +=== [#matrix_expression]#Matrix Expression# + +==== Description + +The templated class `matrix_expression` is required to be a public +base of all classes which model the Matrix Expression concept. + +==== Definition + +Defined in the header expression_types.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E` |The type of the matrix expression. |  +|=== + +==== Model of + +None. [underline]#Not a Matrix Expression# + +==== Type requirements + +None. + +==== Public base classes + +None. + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`const expression_type &operator () () const` |Returns a `const` +reference of the expression. + +|`expression_type &operator () ()` |Returns a reference of the +expression. +|=== + +==== Notes + +The `operator[]`, `row`, `column`, `range`, `slice` and `project` +functions have been removed. Use the free functions defined in +link:matrix_proxy.html[matrix proxy] instead. + +=== [#matrix_container]#Matrix Container# + +==== Description + +The templated class `matrix_container` is required to be a public +base of all classes which model the Matrix concept. This includes the +class `matrix` itself. + +==== Definition + +Defined in the header expression_types.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E` |The type of the matrix expression. |  +|=== + +==== Model of + +None. [underline]#Not a Matrix Expression OR Matrix# + +==== Type requirements + +None. + +==== Public base classes + +`matrix_expression` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`const container_type &operator () () const` |Returns a `const` +reference of the container. + +|`container_type &operator () ()` |Returns a reference of the container. +|=== + +=== [#matrix_references]#Matrix References# + +==== Reference + +===== Description + +The templated class `matrix_reference` contains a reference to a +matrix expression. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E` |The type of the matrix expression. |  +|=== + +===== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Public base classes + +`matrix_expression >` + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_reference (expression_type &e)` |Constructs a constant +reference of the expression. + +|`void resize (size_type size1, size2)` |Resizes the expression to hold +at most `size1` rows of `size2` elements. + +|`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 +the value 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. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the expression. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the expression. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the expression. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +expression. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the expression. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the expression. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the expression. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +expression. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +expression. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed expression. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed expression. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +expression. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed expression. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed expression. +|=== + +=== [#matrix_operations]#Matrix Operations# + +==== Unary Operation Description + +===== Description + +The templated classes `matrix_unary1` and `matrix_unary2` +describe unary matrix operations. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E` |The type of the matrix expression. |  +|`F` |The type of the operation. |  +|=== + +===== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Public base classes + +`matrix_expression >` and +`matrix_expression >` resp. + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_unary1 (const expression_type &e)` |Constructs a description of +the expression. + +|`matrix_unary2 (const expression_type &e)` |Constructs a description of +the expression. + +|`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 +the value of the `j`-th element in the `i`-th row. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the expression. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the expression. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the expression. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the expression. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +expression. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +expression. +|=== + +==== Unary Operations + +===== Prototypes + +[source, cpp] +.... +template + struct matrix_unary1_traits { + typedef matrix_unary1 expression_type; + typedef expression_type result_type; + }; + + // (- m) [i] [j] = - m [i] [j] + template + typename matrix_unary1_traits >::result_type + operator - (const matrix_expression &e); + + // (conj m) [i] [j] = conj (m [i] [j]) + template + typename matrix_unary1_traits >::result_type + conj (const matrix_expression &e); + + // (real m) [i] [j] = real (m [i] [j]) + template + typename matrix_unary1_traits >::result_type + real (const matrix_expression &e); + + // (imag m) [i] [j] = imag (m [i] [j]) + template + typename matrix_unary1_traits >::result_type + imag (const matrix_expression &e); + + template + struct matrix_unary2_traits { + typedef matrix_unary2 expression_type; + typedef expression_type result_type; + }; + + // (trans m) [i] [j] = m [j] [i] + template + typename matrix_unary2_traits >::result_type + trans (const matrix_expression &e); + + // (herm m) [i] [j] = conj (m [j] [i]) + template + typename matrix_unary2_traits >::result_type + herm (const matrix_expression &e); +.... + +===== Description + +`operator -` computes the additive inverse of a matrix expression. +`conj` computes the complex conjugate of a matrix expression. `real` and +`imag` compute the real and imaginary parts of a matrix expression. +`trans` computes the transpose of a matrix expression. `herm` computes +the hermitian, i.e. the complex conjugate of the transpose of a matrix +expression. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Type requirements + +* `E` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Preconditions + +None. + +===== Complexity + +Quadratic depending from the size of the matrix expression. + +===== Examples + +[source, cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix > m (3, 3); + for (unsigned i = 0; i < m.size1 (); ++ i) + for (unsigned j = 0; j < m.size2 (); ++ j) + m (i, j) = std::complex (3 * i + j, 3 * i + j); + + std::cout << - m << std::endl; + std::cout << conj (m) << std::endl; + std::cout << real (m) << std::endl; + std::cout << imag (m) << std::endl; + std::cout << trans (m) << std::endl; + std::cout << herm (m) << std::endl; +} +.... + +==== Binary Operation Description + +===== Description + +The templated class `matrix_binary` describes a binary matrix +operation. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E1` |The type of the first matrix expression. | +|`E2` |The type of the second matrix expression. | +|`F` |The type of the operation. | +|=== + +===== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Public base classes + +`matrix_expression >`. + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_binary (const expression1_type &e1, const expression2_type &e2)` +|Constructs a description of the expression. + +|`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 +the value of the `j`-th element in the `i`-th row. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the expression. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the expression. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the expression. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the expression. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +expression. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +expression. +|=== + +==== Binary Operations + +===== Prototypes + +[source, cpp] +.... +template + struct matrix_binary_traits { + typedef matrix_binary expression_type; + typedef expression_type result_type; + }; + + // (m1 + m2) [i] [j] = m1 [i] [j] + m2 [i] [j] + template + typename matrix_binary_traits >::result_type + operator + (const matrix_expression &e1, + const matrix_expression &e2); + + // (m1 - m2) [i] [j] = m1 [i] [j] - m2 [i] [j] + template + typename matrix_binary_traits >::result_type + operator - (const matrix_expression &e1, + const matrix_expression &e2); +.... + +===== Description + +`operator +` computes the sum of two matrix expressions. `operator -` +computes the difference of two matrix expressions. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Type requirements + +* `E1` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . +* `E2` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Preconditions + +* `e1 ().size1 () == e2 ().size1 ()` +* `e1 ().size2 () == e2 ().size2 ()` + +===== Complexity + +Quadratic depending from the size of the matrix expressions. + +===== Examples + +[source, cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m1 (3, 3), m2 (3, 3); + for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i) + for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j) + m1 (i, j) = m2 (i, j) = 3 * i + j; + + std::cout << m1 + m2 << std::endl; + std::cout << m1 - m2 << std::endl; +} +.... + +==== Scalar Matrix Operation Description + +===== Description + +The templated classes `matrix_binary_scalar1` and +`matrix_binary_scalar2` describe binary operations between a +scalar and a matrix. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E1/E2` |The type of the scalar expression. | +|`E2/E1` |The type of the matrix expression. | +|`F` |The type of the operation. | +|=== + +===== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Public base classes + +`matrix_expression >` and +`matrix_expression >` resp. + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_binary_scalar1 (const expression1_type &e1, const expression2_type &e2)` +|Constructs a description of the expression. + +|`matrix_binary_scalar1 (const expression1_type &e1, const expression2_type &e2)` +|Constructs a description of the expression. + +|`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 +the value of the `j`-th element in the `i`-th row. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the expression. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the expression. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the expression. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the expression. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +expression. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +expression. +|=== + +==== Scalar Matrix Operations + +===== Prototypes + +[source, cpp] +.... +template + struct matrix_binary_scalar1_traits { + typedef matrix_binary_scalar1, + typename E2::const_closure_type, F> expression_type; + typedef expression_type result_type; + }; + + // (t * m) [i] [j] = t * m [i] [j] + template + typename matrix_binary_scalar1_traits >::result_type + operator * (const T1 &e1, + const matrix_expression &e2); + + template + struct matrix_binary_scalar2_traits { + typedef matrix_binary_scalar2, F> expression_type; + typedef expression_type result_type; + }; + + // (m * t) [i] [j] = m [i] [j] * t + template + typename matrix_binary_scalar2_traits >::result_type + operator * (const matrix_expression &e1, + const T2 &e2); + + // (m / t) [i] [j] = m [i] [j] / t + template + typename matrix_binary_scalar2_traits >::result_type + operator / (const matrix_expression &e1, + const T2 &e2); +.... + +===== Description + +`operator *` computes the product of a scalar and a matrix expression. +`operator /` multiplies the matrix with the reciprocal of the scalar. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Type requirements + +* `T1/T2` is a model of +link:expression_concept.html#scalar_expression[Scalar Expression] . +* `E2/E1` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Preconditions + +None. + +===== Complexity + +Quadratic depending from the size of the matrix expression. + +===== Examples + +[source, cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + for (unsigned i = 0; i < m.size1 (); ++ i) + for (unsigned j = 0; j < m.size2 (); ++ j) + m (i, j) = 3 * i + j; + + std::cout << 2.0 * m << std::endl; + std::cout << m * 2.0 << std::endl; +} +.... + +=== [#matrix_vector_operations]#Matrix Vector Operations# + +==== Binary Operation Description + +===== Description + +The templated classes `matrix_vector_binary1` and +`matrix_vector_binary2` describe binary matrix vector +operations. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E1` |The type of the matrix or vector expression. | +|`E2` |The type of the vector or matrix expression. | +|`F` |The type of the operation. | +|=== + +===== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Public base classes + +`vector_expression >` and +`vector_expression >` resp. + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_vector_binary1 (const expression1_type &e1, const expression2_type &e2)` +|Constructs a description of the expression. + +|`matrix_vector_binary2 (const expression1_type &e1, const expression2_type &e2)` +|Constructs a description of the expression. + +|`size_type size () const` |Returns the size of the expression. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the expression. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the expression. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed expression. +|=== + +==== Binary Operations + +===== Prototypes + +[source, cpp] +.... +template + struct matrix_vector_binary1_traits { + typedef row_major_tag dispatch_category; + typedef typename promote_traits::promote_type promote_type; + typedef matrix_vector_binary1 > expression_type; + typedef expression_type result_type; + }; + + template + typename matrix_vector_binary1_traits::result_type + prod (const matrix_expression &e1, + const vector_expression &e2, + row_major_tag); + + // Dispatcher + template + typename matrix_vector_binary1_traits::result_type + prod (const matrix_expression &e1, + const vector_expression &e2); + + template + typename matrix_vector_binary1_traits::precision_type, E1, + typename type_traits::precision_type, E2>::result_type + prec_prod (const matrix_expression &e1, + const vector_expression &e2, + row_major_tag); + + // Dispatcher + template + typename matrix_vector_binary1_traits::precision_type, E1, + typename type_traits::precision_type, E2>::result_type + prec_prod (const matrix_expression &e1, + const vector_expression &e2); + + template + V + prod (const matrix_expression &e1, + const vector_expression &e2); + + template + V + prec_prod (const matrix_expression &e1, + const vector_expression &e2); + + template + struct matrix_vector_binary2_traits { + typedef column_major_tag dispatch_category; + typedef typename promote_traits::promote_type promote_type; + typedef matrix_vector_binary2 > expression_type; + typedef expression_type result_type; + }; + + template + typename matrix_vector_binary2_traits::result_type + prod (const vector_expression &e1, + const matrix_expression &e2, + column_major_tag); + + // Dispatcher + template + typename matrix_vector_binary2_traits::result_type + prod (const vector_expression &e1, + const matrix_expression &e2); + + template + typename matrix_vector_binary2_traits::precision_type, E1, + typename type_traits::precision_type, E2>::result_type + prec_prod (const vector_expression &e1, + const matrix_expression &e2, + column_major_tag); + + // Dispatcher + template + typename matrix_vector_binary2_traits::precision_type, E1, + typename type_traits::precision_type, E2>::result_type + prec_prod (const vector_expression &e1, + const matrix_expression &e2); + + template + V + prod (const vector_expression &e1, + const matrix_expression &e2); + + template + V + prec_prod (const vector_expression &e1, + const matrix_expression &e2); +.... + +===== Description + +`prod` computes the product of the matrix and the vector expression. +`prec_prod` computes the double precision product of the matrix and the +vector expression. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Type requirements + +* `E1` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] or +link:expression_concept.html#vector_expression[Vector Expression] . +* `E2` is a model of +link:expression_concept.html#vector_expression[Vector Expression] or +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Preconditions + +* `e1 ().size2 () == e2 ().size ()` +* `e1 ().size () == e2 ().size1 ()` + +===== Complexity + +Quadratic depending from the size of the matrix expression. + +===== Examples + +[source, cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + vector v (3); + for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) { + for (unsigned j = 0; j < m.size2 (); ++ j) + m (i, j) = 3 * i + j; + v (i) = i; + } + + std::cout << prod (m, v) << std::endl; + std::cout << prod (v, m) << std::endl; +} +.... + +==== Triangular Solver + +===== Prototypes + +[source, cpp] +.... +template + struct matrix_vector_solve_traits { + typedef typename promote_traits::promote_type promote_type; + typedef vector result_type; + }; + + template + void inplace_solve (const matrix_expression &e1, + E2 &e2, + lower_tag, + vector_tag); + template + void inplace_solve (const matrix_expression &e1, + E2 &e2, + upper_tag, + vector_tag); + template + void inplace_solve (const matrix_expression &e1, + E2 &e2, + unit_lower_tag, + vector_tag); + template + void inplace_solve (const matrix_expression &e1, + E2 &e2, + unit_upper_tag, + vector_tag); + + template + typename matrix_vector_solve_traits::result_type + solve (const matrix_expression &e1, + const vector_expression &e2, + C); + + template + void inplace_solve (E1 &e1, + const matrix_expression &e2, + vector_tag, + lower_tag); + template + void inplace_solve (E1 &e1, + const matrix_expression &e2, + vector_tag, + upper_tag); + template + void inplace_solve (E1 &e1, + const matrix_expression &e2, + vector_tag, + unit_lower_tag); + template + void inplace_solve (E1 &e1, + const matrix_expression &e2, + vector_tag, + unit_upper_tag); + + template + typename matrix_vector_solve_traits::result_type + solve (const vector_expression &e1, + const matrix_expression &e2, + C); +.... + +===== Description + +`solve` solves a linear equation for lower or upper (unit) triangular +matrices. + +===== Definition + +Defined in the header triangular.hpp. + +===== Type requirements + +* `E1` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] or +link:expression_concept.html#vector_expression[Vector Expression] . +* `E2` is a model of +link:expression_concept.html#vector_expression[Vector Expression] or +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Preconditions + +* `e1 ().size1 () == e1 ().size2 ()` +* `e1 ().size2 () == e2 ().size ()` +* `e1 ().size () == e2 ().size1 ()` +* `e2 ().size1 () == e2 ().size2 ()` + +===== Complexity + +Quadratic depending from the size of the matrix expression. + +===== Examples + +[source, cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + vector v (3); + for (unsigned i = 0; i < std::min (m.size1 (), v.size ()); ++ i) { + for (unsigned j = 0; j <= i; ++ j) + m (i, j) = 3 * i + j + 1; + v (i) = i; + } + + std::cout << solve (m, v, lower_tag ()) << std::endl; + std::cout << solve (v, m, lower_tag ()) << std::endl; +} +.... + +=== [#matrix_matrix_operations]#Matrix Matrix Operations# + +==== Binary Operation Description + +===== Description + +The templated class `matrix_matrix_binary` describes a binary +matrix operation. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E1` |The type of the first matrix expression. | +|`E2` |The type of the second matrix expression. | +|`F` |The type of the operation. | +|=== + +===== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Public base classes + +`matrix_expression >` . + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_matrix_binary (const expression1_type &e1, const expression2_type &e2)` +|Constructs a description of the expression. + +|`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 +the value of the `j`-th element in the `i`-th row. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the expression. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the expression. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the expression. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the expression. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +expression. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +expression. +|=== + +==== Binary Operations + +===== Prototypes + +[source, cpp] +.... +template + struct matrix_matrix_binary_traits { + typedef unknown_orientation_tag dispatch_category; + typedef typename promote_traits::promote_type promote_type; + typedef matrix_matrix_binary > expression_type; + typedef expression_type result_type; + }; + + template + typename matrix_matrix_binary_traits::result_type + prod (const matrix_expression &e1, + const matrix_expression &e2, + unknown_orientation_tag); + + // Dispatcher + template + typename matrix_matrix_binary_traits::result_type + prod (const matrix_expression &e1, + const matrix_expression &e2); + + template + typename matrix_matrix_binary_traits::precision_type, E1, + typename type_traits::precision_type, E2>::result_type + prec_prod (const matrix_expression &e1, + const matrix_expression &e2, + unknown_orientation_tag); + + // Dispatcher + template + typename matrix_matrix_binary_traits::precision_type, E1, + typename type_traits::precision_type, E2>::result_type + prec_prod (const matrix_expression &e1, + const matrix_expression &e2); + + template + M + prod (const matrix_expression &e1, + const matrix_expression &e2); + + template + M + prec_prod (const matrix_expression &e1, + const matrix_expression &e2); +.... + +===== Description + +`prod` computes the product of the matrix expressions. `prec_prod` +computes the double precision product of the matrix expressions. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Type requirements + +* `E1` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . +* `E2` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Preconditions + +* `e1 ().size2 () == e2 ().size1 ()` + +===== Complexity + +Cubic depending from the size of the matrix expression. + +===== Examples + +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m1 (3, 3), m2 (3, 3); + for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i) + for (unsigned j = 0; j < std::min (m1.size2 (), m2.size2 ()); ++ j) + m1 (i, j) = m2 (i, j) = 3 * i + j; + + std::cout << prod (m1, m2) << std::endl; +} +.... + +==== Triangular Solvers + +===== Prototypes + +[source, cpp] +.... +template + struct matrix_matrix_solve_traits { + typedef typename promote_traits::promote_type promote_type; + typedef matrix result_type; + }; + + template + void inplace_solve (const matrix_expression &e1, + E2 &e2, + lower_tag, + matrix_tag); + template + void inplace_solve (const matrix_expression &e1, + E2 &e2, + upper_tag, + matrix_tag); + template + void inplace_solve (const matrix_expression &e1, + E2 &e2, + unit_lower_tag, + matrix_tag); + template + void inplace_solve (const matrix_expression &e1, + E2 &e2, + unit_upper_tag, + matrix_tag); + + template + typename matrix_matrix_solve_traits::result_type + solve (const matrix_expression &e1, + const matrix_expression &e2, + C); +.... + +===== Description + +`solve` solves a linear equation for lower or upper (unit) triangular +matrices. + +===== Definition + +Defined in the header triangular.hpp. + +===== Type requirements + +* `E1` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . +* `E2` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Preconditions + +* `e1 ().size1 () == e1 ().size2 ()` +* `e1 ().size2 () == e2 ().size1 ()` + +===== Complexity + +Cubic depending from the size of the matrix expressions. + +===== Examples + +[source, cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m1 (3, 3), m2 (3, 3); + for (unsigned i = 0; i < std::min (m1.size1 (), m2.size1 ()); ++ i) + for (unsigned j = 0; j <= i; ++ j) + m1 (i, j) = m2 (i, j) = 3 * i + j + 1; + + std::cout << solve (m1, m2, lower_tag ()) << std::endl; +} +.... + +''''' + +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 ). diff --git a/doc/ublas/matrix_proxy.adoc b/doc/ublas/matrix_proxy.adoc new file mode 100644 index 000000000..0b02e54eb --- /dev/null +++ b/doc/ublas/matrix_proxy.adoc @@ -0,0 +1,1144 @@ +== Matrix Proxies + +[[toc]] + +=== [#matrix_row]#Matrix Row# + +==== Description + +The templated class `matrix_row` allows addressing a row of a matrix. + +==== Example + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + for (unsigned i = 0; i < m.size1 (); ++ i) { + matrix_row > mr (m, i); + for (unsigned j = 0; j < mr.size (); ++ j) + mr (j) = 3 * i + j; + std::cout << mr << std::endl; + } +} +.... + +==== Definition + +Defined in the header matrix_proxy.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`M` |The type of matrix referenced. | +|=== + +==== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +If the specified row falls outside that of the row index range of the +matrix, then the `matrix_row` is not a well formed Vector Expression. +That is, access to an element which is outside of the matrix is +_undefined_. + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +==== Public base classes + +`vector_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_row (matrix_type &data, size_type i)` |Constructs a sub vector. + +|`size_type size () const` |Returns the size of the sub vector. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator () (size_type i)` |Returns a reference of the +`i`-th element. + +|`matrix_row &operator = (const matrix_row &mr)` |The assignment +operator. + +|`matrix_row &assign_temporary (matrix_row &mr)` |Assigns a temporary. +May change the matrix row `mr` . + +|`template matrix_row &operator = (const vector_expression &ae)` +|The extended assignment operator. + +|`template matrix_row &assign (const vector_expression &ae)` +|Assigns a vector expression to the sub vector. Left and right hand side +of the assignment should be independent. + +|`template matrix_row &operator += (const vector_expression &ae)` +|A computed assignment operator. Adds the vector expression to the sub +vector. + +|`template matrix_row &plus_assign (const vector_expression &ae)` +|Adds a vector expression to the sub vector. Left and right hand side of +the assignment should be independent. + +|`template matrix_row &operator -= (const vector_expression &ae)` +|A computed assignment operator. Subtracts the vector expression from +the sub vector. + +|`template matrix_row &minus_assign (const vector_expression &ae)` +|Subtracts a vector expression from the sub vector. Left and right hand +side of the assignment should be independent. + +|`template matrix_row &operator *= (const AT &at)` |A computed +assignment operator. Multiplies the sub vector with a scalar. + +|`template matrix_row &operator /= (const AT &at)` |A computed +assignment operator. Divides the sub vector through a scalar. + +|`void swap (matrix_row &mr)` |Swaps the contents of the sub vectors. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `matrix_row`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `matrix_row`. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the `matrix_row`. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +`matrix_row`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`matrix_row`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`matrix_row`. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed `matrix_row`. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed `matrix_row`. +|=== + +==== Projections + +===== Description + +The free `row` functions support the construction of matrix rows. + +===== Prototypes + +[source,cpp] +.... + template + matrix_row row (M &data, std::size_t i); + template + const matrix_row row (const M &data, std::size_t i); +.... + +===== Definition + +Defined in the header matrix_proxy.hpp. + +===== Type requirements + +* `M` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Complexity + +Linear depending from the size of the row. + +===== Examples + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + for (unsigned i = 0; i < m.size1 (); ++ i) { + for (unsigned j = 0; j < m.size2 (); ++ j) + row (m, i) (j) = 3 * i + j; + std::cout << row (m, i) << std::endl; + } +} +.... + +=== [#matrix_column]#Matrix Column# + +==== Description + +The templated class `matrix_column` allows addressing a column of a +matrix. + +==== Example + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + for (unsigned j = 0; j < m.size2 (); ++ j) { + matrix_column > mc (m, j); + for (unsigned i = 0; i < mc.size (); ++ i) + mc (i) = 3 * i + j; + std::cout << mc << std::endl; + } +} +.... + +==== Definition + +Defined in the header matrix_proxy.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`M` |The type of matrix referenced. | +|=== + +==== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +If the specified column falls outside that of the column index range of +the matrix, then the `matrix_column` is not a well formed Vector +Expression. That is, access to an element which is outside of the matrix +is _undefined_. + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +==== Public base classes + +`vector_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_column (matrix_type &data, size_type j)` |Constructs a sub +vector. + +|`size_type size () const` |Returns the size of the sub vector. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator () (size_type i)` |Returns a reference of the +`i`-th element. + +|`matrix_column &operator = (const matrix_column &mc)` |The assignment +operator. + +|`matrix_column &assign_temporary (matrix_column &mc)` |Assigns a +temporary. May change the matrix column `mc` . + +|`template matrix_column &operator = (const vector_expression &ae)` +|The extended assignment operator. + +|`template matrix_column &assign (const vector_expression &ae)` +|Assigns a vector expression to the sub vector. Left and right hand side +of the assignment should be independent. + +|`template matrix_column &operator += (const vector_expression &ae)` +|A computed assignment operator. Adds the vector expression to the sub +vector. + +|`template matrix_column &plus_assign (const vector_expression &ae)` +|Adds a vector expression to the sub vector. Left and right hand side of +the assignment should be independent. + +|`template matrix_column &operator -= (const vector_expression &ae)` +|A computed assignment operator. Subtracts the vector expression from +the sub vector. + +|`template matrix_column &minus_assign (const vector_expression &ae)` +|Subtracts a vector expression from the sub vector. Left and right hand +side of the assignment should be independent. + +|`template matrix_column &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the sub vector with a scalar. + +|`template matrix_column &operator /= (const AT &at)` |A +computed assignment operator. Divides the sub vector through a scalar. + +|`void swap (matrix_column &mc)` |Swaps the contents of the sub vectors. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `matrix_column`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `matrix_column`. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the `matrix_column`. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +`matrix_column`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`matrix_column`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`matrix_column`. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed `matrix_column`. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed `matrix_column`. +|=== + +==== Projections + +===== Description + +The free `column` functions support the construction of matrix columns. + +===== Prototypes + +[source,cpp] +.... + template + matrix_column column (M &data, std::size_t j); + template + const matrix_column column (const M &data, std::size_t j); +.... + +===== Definition + +Defined in the header matrix_proxy.hpp. + +===== Type requirements + +* `M` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Complexity + +Linear depending from the size of the column. + +===== Examples + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + for (unsigned j = 0; j < m.size2 (); ++ j) { + for (unsigned i = 0; i < m.size1 (); ++ i) + column (m, j) (i) = 3 * i + j; + std::cout << column (m, j) << std::endl; + } +} +.... + +=== [#vector_range]#Vector Range# + +==== Description + +The templated class `matrix_vector_range` allows addressing a sub +vector of a matrix. + +==== Example + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + for (unsigned i = 0; i < m.size1 (); ++ i) + for (unsigned j = 0; j < m.size2 (); ++ j) + m (i, j) = 3 * i + j; + + matrix_vector_range > mvr (m, range (0, 3), range (0, 3)); + std::cout << mvr << std::endl; +} +.... + +==== Definition + +Defined in the header matrix_proxy.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`M` |The type of matrix referenced. | +|=== + +==== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +If the specified ranges fall outside that of the index range of the +matrix, then the `matrix_vector_range` is not a well formed Vector +Expression. That is, access to an element which is outside of the matrix +is _undefined_. + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +==== Public base classes + +`vector_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_vector_range (matrix_type &data, const range &r1, const range &r2)` +|Constructs a sub vector. + +|`size_type size () const` |Returns the size of the sub vector. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator () (size_type i)` |Returns a reference of the +`i`-th element. + +|`matrix_vector_range &operator = (const matrix_vector_range &mvr)` |The +assignment operator. + +|`matrix_vector_range &assign_temporary (matrix_vector_range &mvr)` +|Assigns a temporary. May change the matrix vector range `mvr`. + +|`template matrix_vector_range &operator = (const vector_expression &ae)` +|The extended assignment operator. + +|`template matrix_vector_range &assign (const vector_expression &ae)` +|Assigns a vector expression to the sub vector. Left and right hand side +of the assignment should be independent. + +|`template matrix_vector_range &operator += (const vector_expression &ae)` +|A computed assignment operator. Adds the vector expression to the sub +vector. + +|`template matrix_vector_range &plus_assign (const vector_expression &ae)` +|Adds a vector expression to the sub vector. Left and right hand side of +the assignment should be independent. + +|`template matrix_vector_range &operator -= (const vector_expression &ae)` +|A computed assignment operator. Subtracts the vector expression from +the sub vector. + +|`template matrix_vector_range &minus_assign (const vector_expression &ae)` +|Subtracts a vector expression from the sub vector. Left and right hand +side of the assignment should be independent. + +|`template matrix_vector_range &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the sub vector with a scalar. + +|`template matrix_vector_range &operator /= (const AT &at)` |A +computed assignment operator. Divides the sub vector through a scalar. + +|`void swap (matrix_vector_range &mvr)` |Swaps the contents of the sub +vectors. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `matrix_vector_range`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `matrix_vector_range`. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the `matrix_vector_range`. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +`matrix_vector_range`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the +`matrix_vector_range`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`matrix_vector_range`. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed `matrix_vector_range`. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed `matrix_vector_range`. +|=== + +=== [#vector_slice]#Vector Slice# + +==== Description + +The templated class `matrix_vector_slice` allows addressing a sliced +sub vector of a matrix. + +==== Example + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + for (unsigned i = 0; i < m.size1 (); ++ i) + for (unsigned j = 0; j < m.size2 (); ++ j) + m (i, j) = 3 * i + j; + + matrix_vector_slice > mvs (m, slice (0, 1, 3), slice (0, 1, 3)); + std::cout << mvs << std::endl; +} +.... + +==== Definition + +Defined in the header matrix_proxy.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`M` |The type of matrix referenced. | +|=== + +==== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +If the specified slices fall outside that of the index range of the +matrix, then the `matrix_vector_slice` is not a well formed Vector +Expression. That is, access to an element which is outside of the matrix +is _undefined_. + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +==== Public base classes + +`vector_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_vector_slice (matrix_type &data, const slice &s1, const slice &s2)` +|Constructs a sub vector. + +|`size_type size () const` |Returns the size of the sub vector. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator () (size_type i)` |Returns a reference of the +`i`-th element. + +|`matrix_vector_slice &operator = (const matrix_vector_slice &mvs)` |The +assignment operator. + +|`matrix_vector_slice &assign_temporary (matrix_vector_slice &mvs)` +|Assigns a temporary. May change the matrix vector slice `vs`. + +|`template matrix_vector_slice &operator = (const vector_expression &ae)` +|The extended assignment operator. + +|`template matrix_vector_slice &assign (const vector_expression &ae)` +|Assigns a vector expression to the sub vector. Left and right hand side +of the assignment should be independent. + +|`template matrix_vector_slice &operator += (const vector_expression &ae)` +|A computed assignment operator. Adds the vector expression to the sub +vector. + +|`template matrix_vector_slice &plus_assign (const vector_expression &ae)` +|Adds a vector expression to the sub vector. Left and right hand side of +the assignment should be independent. + +|`template matrix_vector_slice &operator -= (const vector_expression &ae)` +|A computed assignment operator. Subtracts the vector expression from +the sub vector. + +|`template matrix_vector_slice &minus_assign (const vector_expression &ae)` +|Subtracts a vector expression from the sub vector. Left and right hand +side of the assignment should be independent. + +|`template matrix_vector_slice &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the sub vector with a scalar. + +|`template matrix_vector_slice &operator /= (const AT &at)` |A +computed assignment operator. Divides the sub vector through a scalar. + +|`void swap (matrix_vector_slice &mvs)` |Swaps the contents of the sub +vectors. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `matrix_vector_slice`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `matrix_vector_slice`. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the `matrix_vector_slice`. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +`matrix_vector_slice`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`matrix_vector_slice`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`matrix_vector_slice`. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed `matrix_vector_slice`. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed `matrix_vector_slice`. +|=== + +=== [#matrix_range]#Matrix Range# + +==== Description + +The templated class `matrix_range` allows addressing a sub matrix of +a matrix. + +==== Example + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + matrix_range > mr (m, range (0, 3), range (0, 3)); + for (unsigned i = 0; i < mr.size1 (); ++ i) + for (unsigned j = 0; j < mr.size2 (); ++ j) + mr (i, j) = 3 * i + j; + std::cout << mr << std::endl; +} +.... + +==== Definition + +Defined in the header matrix_proxy.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`M` |The type of matrix referenced. | +|=== + +==== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +If the specified ranges fall outside that of the index range of the +matrix, then the `matrix_range` is not a well formed Matrix Expression. +That is, access to an element which is outside of the matrix is +_undefined_. + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +==== Public base classes + +`matrix_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_range (matrix_type &data, const range &r1, const range &r2)` +|Constructs a sub matrix. + +|`size_type start1 () const` |Returns the index of the first row. + +|`size_type size1 () const` |Returns the number of rows. + +|`size_type start2 () const` |Returns the index of the first column. + +|`size_type size2 () const` |Returns the number of columns. + +|`const_reference operator () (size_type i, size_type j) const` |Returns +the value 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. + +|`matrix_range &operator = (const matrix_range &mr)` |The assignment +operator. + +|`matrix_range &assign_temporary (matrix_range &mr)` |Assigns a +temporary. May change the matrix range `mr` . + +|`template matrix_range &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template matrix_range &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the sub matrix. Left and right hand side +of the assignment should be independent. + +|`template matrix_range &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the sub +matrix. + +|`template matrix_range &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the sub matrix. Left and right hand side of +the assignment should be independent. + +|`template matrix_range &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the sub matrix. + +|`template matrix_range &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the sub matrix. Left and right hand +side of the assignment should be independent. + +|`template matrix_range &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the sub matrix with a scalar. + +|`template matrix_range &operator /= (const AT &at)` |A +computed assignment operator. Divides the sub matrix through a scalar. + +|`void swap (matrix_range &mr)` |Swaps the contents of the sub matrices. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `matrix_range`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `matrix_range`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `matrix_range`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`matrix_range`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `matrix_range`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `matrix_range`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `matrix_range`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`matrix_range`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`matrix_range`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`matrix_range`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `matrix_range`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `matrix_range`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`matrix_range`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`matrix_range`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `matrix_range`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of reversed the `matrix_range`. +|=== + +==== Simple Projections + +===== Description + +The free `subrange` functions support the construction of matrix ranges. + +===== Prototypes + +[source,cpp] +.... + template + matrix_range subrange (M &data, + M::size_type start1, M::size_type stop1, M::size_type start2, M::size_type, stop2); + template + const matrix_range subrange (const M &data, + M::size_type start1, M::size_type stop1, M::size_type start2, M::size_type, stop2); +.... + +==== Generic Projections + +===== Description + +The free `project` functions support the construction of matrix ranges. +Existing `matrix_range`'s can be composed with further ranges. The +resulting ranges are computed using this existing ranges' `compose` +function. + +===== Prototypes + +[source,cpp] +.... + template + matrix_range project (M &data, const range &r1, const range &r2); + template + const matrix_range project (const M &data, const range &r1, const range &r2); + template + matrix_range project (matrix_range &data, const range &r1, const range &r2); + template + const matrix_range project (const matrix_range &data, const range &r1, const range &r2); +.... + +===== Definition + +Defined in the header matrix_proxy.hpp. + +===== Type requirements + +* `M` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Complexity + +Quadratic depending from the size of the ranges. + +===== Examples + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + for (unsigned i = 0; i < m.size1 (); ++ i) + for (unsigned j = 0; j < m.size2 (); ++ j) + project (m, range (0, 3), range (0, 3)) (i, j) = 3 * i + j; + std::cout << project (m, range (0, 3), range (0, 3)) << std::endl; +} +.... + +=== [#matrix_slice]#Matrix Slice# + +==== Description + +The templated class `matrix_slice` allows addressing a sliced sub +matrix of a matrix. + +==== Example + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + matrix_slice > ms (m, slice (0, 1, 3), slice (0, 1, 3)); + for (unsigned i = 0; i < ms.size1 (); ++ i) + for (unsigned j = 0; j < ms.size2 (); ++ j) + ms (i, j) = 3 * i + j; + std::cout << ms << std::endl; +} +.... + +==== Definition + +Defined in the header matrix_proxy.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`M` |The type of matrix referenced. | +|=== + +==== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +If the specified slices fall outside that of the index range of the +matrix, then the `matrix_slice` is not a well formed Matrix Expression. +That is, access to an element which is outside of the matrix is +_undefined_. + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +==== Public base classes + +`matrix_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`matrix_slice (matrix_type &data, const slice &s1, const slice &s2)` +|Constructs a sub matrix. + +|`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 +the value 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. + +|`matrix_slice &operator = (const matrix_slice &ms)` |The assignment +operator. + +|`matrix_slice &assign_temporary (matrix_slice &ms)` |Assigns a +temporary. May change the matrix slice `ms` . + +|`template matrix_slice &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template matrix_slice &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the sub matrix. Left and right hand side +of the assignment should be independent. + +|`template matrix_slice &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the sub +matrix. + +|`template matrix_slice &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the sub matrix. Left and right hand side of +the assignment should be independent. + +|`template matrix_slice &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the sub matrix. + +|`template matrix_slice &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the sub matrix. Left and right hand +side of the assignment should be independent. + +|`template matrix_slice &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the sub matrix with a scalar. + +|`template matrix_slice &operator /= (const AT &at)` |A +computed assignment operator. Multiplies the sub matrix through a +scalar. + +|`void swap (matrix_slice &ms)` |Swaps the contents of the sub matrices. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `matrix_slice`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `matrix_slice`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `matrix_slice`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`matrix_slice`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `matrix_slice`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `matrix_slice`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `matrix_slice`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`matrix_slice`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`matrix_slice`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`matrix_slice`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `matrix_slice`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `matrix_slice`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`matrix_slice`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`matrix_slice`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `matrix_slice`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `matrix_slice`. +|=== + +==== Simple Projections + +===== Description + +The free `subslice` functions support the construction of matrix slices. + +===== Prototypes + +[source,cpp] +.... + template + matrix_slice subslice (M &data, + M::size_type start1, M::difference_type stride1, M::size_type size1, + M::size_type start2, M::difference_type stride2, M::size_type size2); + template + const matrix_slice subslice (const M &data, + M::size_type start1, M::difference_type stride1, M::size_type size1, + M::size_type start2, M::difference_type stride2, M::size_type size2); +.... + +==== Generic Projections + +===== Description + +The free `project` functions support the construction of matrix slices. +Existing `matrix_slice` 's can be composed with further ranges or slices. +The resulting slices are computed using this existing slices' `compose` +function. + +===== Prototypes + +[source,cpp] +.... + template + matrix_slice project (M &data, const slice &s1, const slice &s2); + template + const matrix_slice project (const M &data, const slice &s1, const slice &s2); + template + matrix_slice project (matrix_slice &data, const range &r1, const range &r2); + template + const matrix_slice project (const matrix_slice &data, const range &r1, const range &r2); + template + matrix_slice project (matrix_slice &data, const slice &s1, const slice &s2); + template + const matrix_slice project (const matrix_slice &data, const slice &s1, const slice &s2); +.... + +===== Definition + +Defined in the header matrix_proxy.hpp. + +===== Type requirements + +* `M` is a model of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Complexity + +Quadratic depending from the size of the slices. + +===== Examples + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + for (unsigned i = 0; i < m.size1 (); ++ i) + for (unsigned j = 0; j < m.size2 (); ++ j) + project (m, slice (0, 1, 3), slice (0, 1, 3)) (i, j) = 3 * i + j; + std::cout << project (m, slice (0, 1, 3), slice (0, 1, 3)) << std::endl; +} +.... + +''''' + +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 ). diff --git a/doc/ublas/matrix_sparse.adoc b/doc/ublas/matrix_sparse.adoc new file mode 100644 index 000000000..945b7f676 --- /dev/null +++ b/doc/ublas/matrix_sparse.adoc @@ -0,0 +1,660 @@ +== Sparse Matricies + +[[toc]] + +=== [#mapped_matrix]#Mapped Matrix# + +==== Description + +The templated class `mapped_matrix` is the base container +adaptor for sparse matricies using element maps. For a _(m +xn_)-dimensional sparse matrix and _0 < = i < m_, _0 < = j < n_ the +non-zero elements __h__~_i,j_~ are mapped via _(i x n + j)_ for row +major orientation or via _(i + j x m)_ for column major orientation to +consecutive elements of the associative container, i.e. for elements _k_ += __m__~_i1,j1_~ and __k + 1 = __m__~_i2,j2_~ +of the container holds __i__~_1_~ __< i__~_2_~ or +__(i__~_1_~ __= i__~_2_~ and __j__~_1_~ __< j__~_2_~_)_ with row major +orientation or __j__~_1_~ __< j__~_2_~ or __(j__~_1_~ __= j__~_2_~ and +__i__~_1_~ __< __i__~_2_~) with column major orientation. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + mapped_matrix m (3, 3, 3 * 3); + for (unsigned i = 0; i < m.size1 (); ++ i) + for (unsigned j = 0; j < m.size2 (); ++ j) + m (i, j) = 3 * i + j; + std::cout << m << std::endl; +} +.... + +==== Definition + +Defined in the header matrix_sparse.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the mapped matrix. | + +|`F` |Functor describing the storage organization. +link:#mapped_matrix_1[[1]] |`row_major` + +|`A` |The type of the adapted array. link:#mapped_matrix_2[[2]] +|`map_std` +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`mapped_matrix ()` |Allocates a `mapped_matrix` that holds at most zero +rows of zero elements. + +|`mapped_matrix (size_type size1, size_type2, size_type non_zeros = 0)` +|Allocates a `mapped_matrix` that holds at most `size1` rows of `size2` +elements. + +|`mapped_matrix (const mapped_matrix &m)` |The copy constructor. + +|`template mapped_matrix (size_type non_zeros, const matrix_expression &ae)` +|The extended copy constructor. + +|`void resize (size_type size1, size_type size2, bool preserve = true)` +|Reallocates a `mapped_matrix` to hold at most `size1` rows of `size2` +elements. The existing elements of the `mapped_matrix` are preseved when +specified. + +|`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 +the value 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. + +|`mapped_matrix &operator = (const mapped_matrix &m)` |The assignment +operator. + +|`mapped_matrix &assign_temporary (mapped_matrix &m)` |Assigns a +temporary. May change the mapped matrix `m` . + +|`template mapped_matrix &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template mapped_matrix &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the mapped matrix. Left and right hand +side of the assignment should be independent. + +|`template mapped_matrix &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +mapped matrix. + +|`template mapped_matrix &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the mapped matrix. Left and right hand side +of the assignment should be independent. + +|`template mapped_matrix &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the mapped matrix. + +|`template mapped_matrix &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the mapped matrix. Left and right +hand side of the assignment should be independent. + +|`template mapped_matrix &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the mapped matrix with a +scalar. + +|`template mapped_matrix &operator /= (const AT &at)` |A +computed assignment operator. Divides the mapped matrix through a +scalar. + +|`void swap (mapped_matrix &m)` |Swaps the contents of the mapped +matrices. + +|`true_refrence insert_element (size_type i, size_type j, const_reference t)` +|Inserts the value `t` at the `j`-th element of the `i`-th row. +Duplicates elements are not allowed. + +|`void erase_element (size_type i, size_type j)` |Erases the value at +the `j`-th element of the `i`-th row. + +|`void clear ()` |Clears the mapped matrix. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `mapped_matrix`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `mapped_matrix`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `mapped_matrix`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`mapped_matrix`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `mapped_matrix`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `mapped_matrix`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `mapped_matrix`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`mapped_matrix`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`mapped_matrix`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`mapped_matrix`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `mapped_matrix`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `mapped_matrix`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`mapped_matrix`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`mapped_matrix`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `mapped_matrix`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `mapped_matrix`. +|=== + +==== Notes + +[#mapped_matrix_1]#[1]# Supported parameters for the storage +organization are `row_major` and `column_major`. + +[#mapped_matrix_2]#[2]# Supported parameters for the adapted array are +`map_array` and `map_std`. The latter is +equivalent to `std::map`. + +=== [#compressed_matrix]#Compressed Matrix# + +==== Description + +The templated class `compressed_matrix` is the base +container adaptor for compressed matrices. For a _(m x n_ )-dimensional +compressed matrix and _0 < = i < m_, _0 < = j < n_ the non-zero elements +__m__~_i,j_~ are mapped via _(i x n + j)_ for row major orientation or +via _(i + j x m)_ for column major orientation to consecutive elements +of the index and value containers, i.e. for elements _k_ = +__m__~_i1,j1_~and __k + 1 = __m__~_i2,j2_~ +of the container holds __i__~_1_~ __< i__~_2_~ or +__(i__~_1_~ __= i__~_2_~ and __j__~_1_~ __< j__~_2_~_)_ with row major +orientation or __j__~_1_~ __< j__~_2_~ or __(j__~_1_~ __= j__~_2_~ and +__i__~_1_~ __< i__~_2_~_)_ with column major orientation. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + compressed_matrix m (3, 3, 3 * 3); + for (unsigned i = 0; i < m.size1 (); ++ i) + for (unsigned j = 0; j < m.size2 (); ++ j) + m (i, j) = 3 * i + j; + std::cout << m << std::endl; +} +.... + +==== Definition + +Defined in the header matrix_sparse.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the compressed matrix. | + +|`F` |Functor describing the storage organization. +link:#compressed_matrix_1[[1]] |`row_major` + +|`IB` |The index base of the compressed vector. +link:#compressed_matrix_2[[2]] |`0` + +|`IA` |The type of the adapted array for indices. +link:#compressed_matrix_3[[3]] |`unbounded_array` + +|`TA` |The type of the adapted array for values. +link:#compressed_matrix_3[[3]] |`unbounded_array` +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`compressed_matrix ()` |Allocates a `compressed_matrix` that holds at +most zero rows of zero elements. + +|`compressed_matrix (size_type size1, size_type2, size_type non_zeros = 0)` +|Allocates a `compressed_matrix` that holds at most `size1` rows of +`size2` elements. + +|`compressed_matrix (const compressed_matrix &m)` |The copy constructor. + +|`template compressed_matrix (size_type non_zeros, const matrix_expression &ae)` +|The extended copy constructor. + +|`void resize (size_type size1, size_type size2, bool preserve = true)` +|Reallocates a `compressed_matrix` to hold at most `size1` rows of +`size2` elements. The existing elements of the `compressed_matrix` are +preseved when specified. + +|`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 +the value 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. + +|`compressed_matrix &operator = (const compressed_matrix &m)` |The +assignment operator. + +|`compressed_matrix &assign_temporary (compressed_matrix &m)` |Assigns a +temporary. May change the compressed matrix `m`. + +|`template compressed_matrix &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template compressed_matrix &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the compressed matrix. Left and right +hand side of the assignment should be independent. + +|`template compressed_matrix &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +compressed matrix. + +|`template compressed_matrix &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the compressed matrix. Left and right hand +side of the assignment should be independent. + +|`template compressed_matrix &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the compressed matrix. + +|`template compressed_matrix &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the compressed matrix. Left and +right hand side of the assignment should be independent. + +|`template compressed_matrix &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the compressed matrix with a +scalar. + +|`template compressed_matrix &operator /= (const AT &at)` |A +computed assignment operator. Divides the compressed matrix through a +scalar. + +|`void swap (compressed_matrix &m)` |Swaps the contents of the +compressed matrices. + +|`true_reference insert_element (size_type i, size_type j, const_reference t)` +|Inserts the value `t` at the `j`-th element of the `i`-th row. +Duplicates elements are not allowed. + +|`void erase_element (size_type i, size_type j)` |Erases the value at +the `j`-th element of the `i`-th row. + +|`void clear ()` |Clears the compressed matrix. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `compressed_matrix`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `compressed_matrix`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `compressed_matrix`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`compressed_matrix`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `compressed_matrix`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `compressed_matrix`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `compressed_matrix`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`compressed_matrix`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`compressed_matrix`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`compressed_matrix`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `compressed_matrix`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `compressed_matrix`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`compressed_matrix`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`compressed_matrix`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `compressed_matrix`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `compressed_matrix`. +|=== + +==== Notes + +[#compressed_matrix_1]#[1]# Supported parameters for the storage +organization are `row_major` and `column_major`. + +[#compressed_matrix_2]#[2]# Supported parameters for the index base are +`0` and `1` at least. + +[#compressed_matrix_3]#[3]# Supported parameters for the adapted array +are `unbounded_array<>` , `bounded_array<>` and `std::vector<>` . + +=== [#coordinate_matrix]#Coordinate Matrix# + +==== Description + +The templated class `coordinate_matrix` is the base +container adaptor for compressed matrices. For a _(m x n_ )-dimensional +sorted coordinate matrix and _0 < = i < m_, _0 < = j < n_ the non-zero +elements __m__~_i,j_~ are mapped via _(i x n + j)_ for row major +orientation or via _(i + j x m)_ for column major orientation to +consecutive elements of the index and value containers, i.e. for +elements _k_ = __m__~_i1,j1_~ and __k + 1 = +__m__~_i2,j2_~ of the container holds __i__~_1_~ __< +i__~_2_~ or __(i__~_1_~ __= i__~_2_~ and __j__~_1_~ __< j__~_2_~_)_ with +row major orientation or __j__~_1_~ __< j__~_2_~ or __(j__~_1_~ __= +j__~_2_~ and __i__~_1_~ __< i__~_2_~_)_ with column major orientation. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + coordinate_matrix m (3, 3, 3 * 3); + for (unsigned i = 0; i < m.size1 (); ++ i) + for (unsigned j = 0; j < m.size2 (); ++ j) + m (i, j) = 3 * i + j; + std::cout << m << std::endl; +} +.... + +==== Definition + +Defined in the header matrix_sparse.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the coordinate matrix. | + +|`F` |Functor describing the storage organization. +link:#coordinate_matrix_1[[1]] |`row_major` + +|`IB` |The index base of the coordinate vector. +link:#coordinate_matrix_2[[2]] |`0` + +|`IA` |The type of the adapted array for indices. +link:#coordinate_matrix_3[[3]] |`unbounded_array` + +|`TA` |The type of the adapted array for values. +link:#coordinate_matrix_3[[3]] |`unbounded_array` +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`coordinate_matrix ()` |Allocates a `coordinate_matrix` that holds at +most zero rows of zero elements. + +|`coordinate_matrix (size_type size1, size_type2, size_type non_zeros = 0)` +|Allocates a `coordinate_matrix` that holds at most `size1` rows of +`size2` elements. + +|`coordinate_matrix (const coordinate_matrix &m)` |The copy constructor. + +|`template coordinate_matrix (size_type non_zeros, const matrix_expression &ae)` +|The extended copy constructor. + +|`void resize (size_type size1, size_type size2, bool preserve = true)` +|Reallocates a `coordinate_matrix` to hold at most `size1` rows of +`size2` elements. The existing elements of the `coordinate_matrix` are +preseved when specified. + +|`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 +the value 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. + +|`coordinate_matrix &operator = (const coordinate_matrix &m)` |The +assignment operator. + +|`coordinate_matrix &assign_temporary (coordinate_matrix &m)` |Assigns a +temporary. May change the coordinate matrix `m`. + +|`template coordinate_matrix &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template coordinate_matrix &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the coordinate matrix. Left and right +hand side of the assignment should be independent. + +|`template coordinate_matrix &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +coordinate matrix. + +|`template coordinate_matrix &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the coordinate matrix. Left and right hand +side of the assignment should be independent. + +|`template coordinate_matrix &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the coordinate matrix. + +|`template coordinate_matrix &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the coordinate matrix. Left and +right hand side of the assignment should be independent. + +|`template coordinate_matrix &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the coordinate matrix with a +scalar. + +|`template coordinate_matrix &operator /= (const AT &at)` |A +computed assignment operator. Divides the coordinate matrix through a +scalar. + +|`void swap (coordinate_matrix &m)` |Swaps the contents of the +coordinate matrices. + +|`true_reference insert_element (size_type i, size_type j, const_reference t)` +|Inserts the value `t` at the `j`-th element of the `i`-th row. +Duplicates elements are not allowed. + +|`void append_element (size_type i, size_type j, const_reference t)` +|Appends the value `t` at the `j`-th element of the `i`-th row. +Duplicate elements can be appended to a `coordinate_matrix`. They are +merged into a single arithmetically summed element by the `sort` +function. + +|`void erase_element (size_type i, size_type j)` |Erases the value at +the `j`-th element of the `i`-th row. + +|`void clear ()` |Clears the coordinate matrix. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `coordinate_matrix`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `coordinate_matrix`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `coordinate_matrix`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`coordinate_matrix`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `coordinate_matrix`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `coordinate_matrix`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `coordinate_matrix`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`coordinate_matrix`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`coordinate_matrix`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`coordinate_matrix`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `coordinate_matrix`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `coordinate_matrix`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`coordinate_matrix`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`coordinate_matrix`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `coordinate_matrix`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `coordinate_matrix`. +|=== + +==== Notes + +[#coordinate_matrix_1]#[1]# Supported parameters for the storage +organization are `row_major` and `column_major`. + +[#coordinate_matrix_2]#[2]# Supported parameters for the index base are +`0` and `1` at least. + +[#coordinate_matrix_3]#[3]# Supported parameters for the adapted array +are `unbounded_array<>` , `bounded_array<>` and `std::vector<>` . + +''''' + +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 ). diff --git a/doc/ublas/operations_overview.adoc b/doc/ublas/operations_overview.adoc new file mode 100644 index 000000000..64c107864 --- /dev/null +++ b/doc/ublas/operations_overview.adoc @@ -0,0 +1,283 @@ +== Overview of Tensor, Matrix and Vector Operations + +[[toc]] + +Contents::: + link:#blas[Basic Linear Algebra] + + + link:#advanced[Advanced Functions] + + + link:#sub[Submatrices, Subvectors] + + + link:#speed[Speed Improvements] + +=== Definitions + +[cols=",",] +|=== +|`X, Y, Z` |are tensors +|`A, B, C` |are matrices +|`u, v, w` |are vectors +|`i, j, k` |are integer values +|`t, t1, t2` |are scalar values +|`r, r1, r2` |are link:range.html[ranges], e.g. `range(0, 3)` +|`s, s1, s2` |are link:range.html#slice[slices], e.g. `slice(0, 1, 3)` +|=== + +=== [#blas]#Basic Linear Algebra# + +==== standard operations: addition, subtraction, multiplication by a scalar + +.... +X = Y + Z; X = Y - Z; X = -Y; +C = A + B; C = A - B; C = -A; +w = u + v; w = u - v; w = -u; +X = t * Y; Y = X * t; X = Y / t; +C = t * A; C = A * t; C = A / t; +w = t * u; w = u * t; w = u / t; +.... + +==== computed assignments + +.... +X += Y; X -= Y; +C += A; C -= A; +w += u; w -= u; +X *= t; X /= t; +C *= t; C /= t; +w *= t; w /= t; +.... + +==== inner, outer and other products + +.... +t = inner_prod(u, v); +C = outer_prod(u, v); +w = prod(A, u); w = prod(u, A); w = prec_prod(A, u); w = prec_prod(u, A); +C = prod(A, B); C = prec_prod(A, B); +w = element_prod(u, v); w = element_div(u, v); +C = element_prod(A, B); C = element_div(A, B); +.... + +==== tensor products + +.... +Z = prod(X, v, t); +Z = prod(X, A, t); +Z = prod(X, Y, p); +Z = prod(X, Y, pa, pb); +t = inner_prod(X, Y); +Z = outer_prod(X, Y); +.... + +==== transformations + +.... +w = conj(u); w = real(u); w = imag(u); +C = trans(A); C = conj(A); C = herm(A); C = real(A); C = imag(A); +Z = trans(X); Z = conj(X); Z = real(X); Z = imag(X); +.... + +=== [#advanced]#Advanced functions# + +==== norms + +.... +t = norm_inf(v); i = index_norm_inf(v); +t = norm_1(v); t = norm_2(v); +t = norm_2_square(v); +t = norm_inf(A); i = index_norm_inf(A); +t = norm_1(A); t = norm_frobenius(A); +t = norm(X); +.... + +==== products + +.... +axpy_prod(A, u, w, true); // w = A * u +axpy_prod(A, u, w, false); // w += A * u +axpy_prod(u, A, w, true); // w = trans(A) * u +axpy_prod(u, A, w, false); // w += trans(A) * u +axpy_prod(A, B, C, true); // C = A * B +axpy_prod(A, B, C, false); // C += A * B +.... + +*_Note:_ The last argument (`bool init`) of `axpy_prod` is optional. +Currently it defaults to `true`, but this may change in the future. +Setting the `init` to `true` is equivalent to calling `w.clear()` before +`axpy_prod`. There are some specialisation for products of compressed +matrices that give a large speed up compared to `prod`.* + +.... +w = block_prod (A, u); // w = A * u +w = block_prod (u, A); // w = trans(A) * u +C = block_prod (A, B); // C = A * B +.... + +*_Note:_ The blocksize can be any integer. However, the actual speed +depends very significantly on the combination of blocksize, CPU and +compiler. The function `block_prod` is designed for large dense +matrices.* + +==== rank-k updates + +.... +opb_prod(A, B, C, true); // C = A * B +opb_prod(A, B, C, false); // C += A * B +.... + +*_Note:_ The last argument (`bool init`) of `opb_prod` is optional. +Currently it defaults to `true`, but this may change in the future. This +function may give a speedup if `A` has less columns than rows, because +the product is computed as a sum of outer products.* + +=== [#sub]#Submatrices, Subvectors# + +Accessing submatrices and subvectors via *proxies* using `project` +functions: + +.... +w = project(u, r); // the subvector of u specifed by the index range r +w = project(u, s); // the subvector of u specifed by the index slice s +C = project(A, r1, r2); // the submatrix of A specified by the two index ranges r1 and r2 +C = project(A, s1, s2); // the submatrix of A specified by the two index slices s1 and s2 +w = row(A, i); w = column(A, j); // a row or column of matrix as a vector +.... + +Assigning to submatrices and subvectors via *proxies* using `project` +functions: + +.... +project(u, r) = w; // assign the subvector of u specifed by the index range r +project(u, s) = w; // assign the subvector of u specifed by the index slice s +project(A, r1, r2) = C; // assign the submatrix of A specified by the two index ranges r1 and r2 +project(A, s1, s2) = C; // assign the submatrix of A specified by the two index slices s1 and s2 +row(A, i) = w; column(A, j) = w; // a row or column of matrix as a vector +.... + +*_Note:_ A range `r = range(start, stop)` contains all indices `i` with +`start <= i < stop`. A slice is something more general. The slice +`s = slice(start, stride, size)` contains the indices +`start, start+stride, ..., start+(size-1)*stride`. The stride can be 0 +or negative! If `start >= stop` for a range or `size == 0` for a slice +then it contains no elements.* + +Sub-ranges and sub-slices of vectors and matrices can be created +directly with the `subrange` and `sublice` functions: + +.... +w = subrange(u, 0, 2); // the 2 element subvector of u +w = subslice(u, 0, 1, 2); // the 2 element subvector of u +C = subrange(A, 0,2, 0,3); // the 2x3 element submatrix of A +C = subslice(A, 0,1,2, 0,1,3); // the 2x3 element submatrix of A +subrange(u, 0, 2) = w; // assign the 2 element subvector of u +subslice(u, 0, 1, 2) = w; // assign the 2 element subvector of u +subrange(A, 0,2, 0,3) = C; // assign the 2x3 element submatrix of A +subrange(A, 0,1,2, 0,1,3) = C; // assigne the 2x3 element submatrix of A +.... + +There are to more ways to access some matrix elements as a vector: + +.... +matrix_vector_range (A, r1, r2); +matrix_vector_slice (A, s1, s2); +.... + +*_Note:_ These matrix proxies take a sequence of elements of a matrix and +allow you to access these as a vector. In particular +`matrix_vector_slice` can do this in a very general way. +`matrix_vector_range` is less useful as the elements must lie along a +diagonal.* + +_Example:_ To access the first two elements of a sub column of a matrix +we access the row with a slice with stride 1 and the column with a slice +with stride 0 thus: + +`matrix_vector_slice (A, slice(0,1,2), slice(0,0,2));` + +=== [#speed]#Speed improvements# + +==== [#noalias]#Matrix / Vector assignment# + +If you know for sure that the left hand expression and the right hand +expression have no common storage, then assignment has no _aliasing_. A +more efficient assignment can be specified in this case: + +.... +noalias(C) = prod(A, B); +.... + +This avoids the creation of a temporary matrix that is required in a +normal assignment. 'noalias' assignment requires that the left and right +hand side be size conformant. + +==== Sparse element access + +The matrix element access function `A(i1,i2)` or the equivalent vector +element access functions (`v(i) or v[i]`) usually create 'sparse element +proxies' when applied to a sparse matrix or vector. These _proxies_ +allow access to elements without having to worry about nasty C++ issues +where references are invalidated. + +These 'sparse element proxies' can be implemented more efficiently when +applied to `const` objects. Sadly in C++ there is no way to distinguish +between an element access on the left and right hand side of an +assignment. Most often elements on the right hand side will not be +changed and therefore it would be better to use the `const` proxies. We +can do this by making the matrix or vector `const` before accessing it's +elements. For example: + +.... +value = const_cast(v)[i]; // VEC is the type of V +.... + +If more then one element needs to be accessed `const_iterator` 's should +be used in preference to `iterator` 's for the same reason. For the more +daring 'sparse element proxies' can be completely turned off in uBLAS by +defining the configuration macro `BOOST_UBLAS_NO_ELEMENT_PROXIES`. + +==== Controlling the complexity of nested products + +What is the complexity (the number of add and multiply operations) +required to compute the following? + +.... + R = prod(A, prod(B,C)); +.... + +Firstly the complexity depends on matrix size. Also since prod is +transitive (not commutative) the bracket order affects the complexity. + +uBLAS evaluates expressions without matrix or vector temporaries and +honours the bracketing structure. However avoiding temporaries for +nested product unnecessarly increases the complexity. Conversly by +explictly using temporary matrices the complexity of a nested product +can be reduced. + +uBLAS provides 3 alternative syntaxes for this purpose: + +.... + temp_type T = prod(B,C); R = prod(A,T); // Preferable if T is preallocated +.... + +.... + prod(A, temp_type(prod(B,C)); +.... + +.... + prod(A, prod(B,C)); +.... + +The 'temp_type' is important. Given A,B,C are all of the same type. Say +matrix, the choice is easy. However if the value_type is mixed +(int with float or double) or the matrix type is mixed (sparse with +symmetric) the best solution is not so obvious. It is up to you! It +depends on numerical properties of A and the result of the prod(B,C). + +''''' + +Copyright (©) 2000-2007 Joerg Walter, Mathias Koch, Gunter Winkler, +Michael Stevens + +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 ). diff --git a/doc/ublas/options.adoc b/doc/ublas/options.adoc new file mode 100644 index 000000000..a9e26bad9 --- /dev/null +++ b/doc/ublas/options.adoc @@ -0,0 +1,188 @@ +== Boost Basic Linear Algebra - Configuration Options + +[[toc]] + +link:index.html[back to uBLAS home] + +=== NDEBUG + +*Make sure you define NDEBUG* The only way uBLAS knows you want a +release configuration is to check if you have defined NDEBUG. If you +don't it assumes you want a debug configuration and adds a lot of very +useful runtime check. However these are very slow! + +=== BOOST_UBLAS_MOVE_SEMANTICS + +The patch and description was provided by Nasos Iliopoulos. + +An immediate effect of this option is the elimination of the need for +noalias in types vector and matrix, when assigned to the same +type. This option doesn't have an effect on bounded and c types. +Although it is rare, not all compilers support copy elision (that allows +for move semantics), so a test must be performed to make sure that there +is a benefit when it is enabled. A small demonstration and test can be +found in +link:../test/manual/test_move_semantics.cpp[test_move_semantics.cpp] + +In the link:../test/manual/test_move_semantics.cpp[test example] two +tests are defined, one for vectors and one for matrices. The aim of this +example is to print the pointers of the storage of each of the +containers, before and after the assignment to a temporary object. When +move semantics are enabled, the vector and matrix storage is moved +from the temporary and no copy is performed. + +If move semantics are supported by your compiler you will get an output +like the following: + +[source,screen] +---- +matrix -------------------------------------------------------------------- +Temporary pointer r: 0x94790c0 +Pointer (must be equal to temp. pointer if move semantics are enabled) : 0x94790c0 +---- + +Notes: + +* It should be no surprise to see matrices and vectors been passed by +VALUE, the compiler takes care and either moves (if the underlying code +does not modify the object), or copies (if the underlying code modifies +the object). +* There might be some space for some improvements (like clearing the +data, before swaping) +* Move semantics don't eliminate temporaries. They rather move their +storage around so no copies are performed. +* MSVC does no implement Named Return Value Optimization in debug mode. +So if you build in debug with this compiler you might get +https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=483229[different +behaviour] than a release build. +* Enabling move semantics is done via #define +BOOST_UBLAS_MOVE_SEMANTICS. +* There is plenty of room for optimizations when c++0x standard is out, +taking advantage of rvalue references. (I have a sweet vector +implementation using that). +* If you enable move semantics and your compiler does not support them, +the operation will just be as passing by const reference. + +Interesting links + +* http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/[Want +Speed? Pass by Value.] +* http://blogs.msdn.com/vcblog/archive/2009/02/03/rvalue-references-c-0x-features-in-vc10-part-2.aspx[Rvalue +References: C++0x Features in VC10, Part 2] +* http://cpp-next.com/archive/2009/09/move-it-with-rvalue-references/[Move +It With Rvalue References] + +=== BOOST_UBLAS_CHECK_ENABLE + +When BOOST_UBLAS_CHECK_ENABLE is defined then all index and parameter +checks are enabled. This is enabled in debug mode and disabled in +release mode. + +=== BOOST_UBLAS_TYPE_CHECK + +When BOOST_UBLAS_TYPE_CHECK is enabled then all possibly expensive +structure checks are enabled. If this is not desireable then use #define +BOOST_UBLAS_TYPE_CHECK 0 before including any uBLAS header. The define +BOOST_UBLAS_TYPE_CHECK_EPSILON can be used to control the acceptable +tolerance, see detail/matrix_assign.hpp for implementation details of +this check. + +=== BOOST_UBLAS_USE_LONG_DOUBLE + +Enable uBLAS expressions that involve containers of 'long double' + +=== BOOST_UBLAS_USE_INTERVAL + +Enable uBLAS expressions that involve containers of +'boost::numeric::interval' types + +=== Configuring uBLAS with Macros + +Many macro's appear in ublas/config.hpp and elsewhere. Hopefully in the +future some of these will disappear! They fall into 4 groups: + +* Automatically set by 'boost/numeric/ublas/config.hpp' based on NDEBUG. +Makes the distinction between debug (safe) and release (fast) mode. +Similar to STLport +** _Release_ mode (NDEBUG defined) +*** BOOST_UBLAS_INLINE _Compiler dependant definition to control +function inlining._ +*** BOOST_UBLAS_USE_FAST_SAME +** _Debug_ mode +*** BOOST_UBLAS_CHECK_ENABLE _Enable checking of indexs, iterators and +parameters. Prevents out of bound access etc._ +*** BOOST_UBLAS_TYPE_CHECK _Enable additional checks for the results of +expressions using non dense types. Picks up runtime error such as the +assignment of a numerically non-symmetric matrix to symmertic_matrix. +Use #define BOOST_UBLAS_TYPE_CHECK 0 to disable expensive numeric type +checks._ (Note: "structure check" would be a much better name.) +*** BOOST_UBLAS_TYPE_CHECK_EPSILON _default: sqrt(epsilon), controls how +large the difference between the expected result and the computed result +may become. Increase this value if you are going to use near singular or +badly scaled matrices. Please, refer to detail/matrix_assign.hpp for +implementation of these type checks._ +* Automatically set by 'boost/numeric/ublas/config.hpp' based on +compiler and boost/config.hpp macro's. Augments the compiler deficiency +workarounds already supplied by boost/config.hpp +** BOOST_UBLAS_NO_NESTED_CLASS_RELATION _A particularly nasty problem +with VC7.1 Requires that uBLAS and the user use begin(it) rather then +it.begin()_ +** BOOST_UBLAS_NO_SMART_PROXIES _Disable the automatic propagation of +'constantness' to proxies. Smart proxies automatically determine if the +underling container they reference is constant or not. They adjust there +definition of iterators and container access to reflect this +constantness._ +* For use by uBLAS authors to test implementation methods. Preset in +config.hpp +** BOOST_UBLAS_USE_INVARIANT_HOISTING +** BOOST_UBLAS_USE_INDEXING +** BOOST_UBLAS_USE_INDEXED_ITERATOR +** BOOST_UBLAS_NON_CONFORMANT_PROXIES _Gappy containers may be +non-conformant, that is contain elements at different indices. Assigning +between proxies (vector ranges for example) of these containers is +difficult as the LHS may need insert new elements. This is slow._ +** BOOST_UBLAS_USE_DUFF_DEVICE _Near useless on all platforms (see GCC's +-funroll-loops)_ +* User options. Can be predefined by user before including any uBLAS +headers. They may also be automatically defined for some compilers to +work around compile bugs. +** BOOST_UBLAS_USE_LONG_DOUBLE _Enable uBLAS expressions that involve +containers of 'long double'_ +** BOOST_UBLAS_USE_INTERVAL _Enable uBLAS expressions that involve +containers of 'boost::numeric::interval' types_ +** BOOST_UBLAS_SIMPLE_ET_DEBUG _In order to simplify debugging is is +possible to simplify expression templateso they are restricted to a +single operation_ +** BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS _enable automatic conversion from +proxy class to matrix expression_ +** BOOST_UBLAS_NO_ELEMENT_PROXIES _Disables the use of element proxies +for gappy types._ +** _The Gappy types (sparse, coordinate, compressed) store non-zero +elements in their own containers. When new non-zero elements are +assigned they must rearrange these containers. This invalidates +references, iterators or pointers to these elements. This can happen at +some surprising times such as the expression "a [1] = a [0] = 1;". +Element proxies guarantee all such expressions will work as expected. +However they bring their own restrictions and efficiency problems. For +example as of Boost 1.30.0 they prevent the assignment of elements +between different types._ +** BOOST_UBLAS_REFERENCE_CONST_MEMBER _Enable to allow refernces to be +returned to fixed (zero or one) elements of triangular or banded +matrices_ +** BOOST_UBLAS_NO_EXCEPTIONS _Disable the use exceptions of uBLAS +internal checks and error conditions. BOOST_NO_EXCEPTIONS has same +effect._ +** BOOST_UBLAS_SINGULAR_CHECK _Check the for singularity in triangular +solve() functions_ + +''''' + +[[copyright]] +Copyright (©) 2000-2009 Joerg Walter, Mathias Koch, Gunter Winkler + +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 ). + +[[revision]] +Last modified: Wed Sep 16 23:16:45 CEST 2009 diff --git a/doc/ublas/overview.adoc b/doc/ublas/overview.adoc new file mode 100644 index 000000000..da86f1dd2 --- /dev/null +++ b/doc/ublas/overview.adoc @@ -0,0 +1,582 @@ +== uBLAS Overview + +[[toc]] + +=== Rationale + +It would be nice if every kind of numeric software could be written in +C++ without loss of efficiency, but unless something can be found that +achieves this without compromising the C++ type system it may be +preferable to rely on Fortran, assembler or architecture-specific +extensions (Bjarne Stroustrup). + +This C++ library is directed towards scientific computing on the level +of basic linear algebra constructions with matrices and vectors and +their corresponding abstract operations. The primary design goals were: + +* mathematical notation +* efficiency +* functionality +* compatibility + +Another intention was to evaluate, if the abstraction penalty resulting +from the use of such matrix and vector classes is acceptable. + +=== Resources + +The development of this library was guided by a couple of similar +efforts: + +* http://www.netlib.org/blas/index.html[BLAS] by Jack Dongarra et al. +* http://www.oonumerics.org/blitz/[Blitz++] by Todd Veldhuizen +* http://acts.nersc.gov/pooma/[POOMA] by Scott Haney et al. +* http://www.lsc.nd.edu/research/mtl/[MTL] by Jeremy Siek et al. + +BLAS seems to be the most widely used library for basic linear algebra +constructions, so it could be called a de-facto standard. Its interface +is procedural, the individual functions are somewhat abstracted from +simple linear algebra operations. Due to the fact that is has been +implemented using Fortran and its optimizations, it also seems to be one +of the fastest libraries available. As we decided to design and +implement our library in an object-oriented way, the technical +approaches are distinct. However anyone should be able to express BLAS +abstractions in terms of our library operators and to compare the +efficiency of the implementations. + +Blitz++ is an impressive library implemented in C++. Its main design +seems to be oriented towards multidimensional arrays and their +associated operators including tensors. The author of Blitz++ states, +that the library achieves performance on par or better than +corresponding Fortran code due to his implementation technique using +expression templates and template metaprograms. However we see some +reasons, to develop an own design and implementation approach. We do not +know whether anybody tries to implement traditional linear algebra and +other numerical algorithms using Blitz++. We also presume that even +today Blitz++ needs the most advanced C++ compiler technology due to its +implementation idioms. On the other hand, Blitz++ convinced us, that the +use of expression templates is mandatory to reduce the abstraction +penalty to an acceptable limit. + +POOMA's design goals seem to parallel Blitz++'s in many parts . It +extends Blitz++'s concepts with classes from the domains of partial +differential equations and theoretical physics. The implementation +supports even parallel architectures. + +MTL is another approach supporting basic linear algebra operations in +C++. Its design mainly seems to be influenced by BLAS and the C++ +Standard Template Library. We share the insight that a linear algebra +library has to provide functionality comparable to BLAS. On the other +hand we think, that the concepts of the C++ standard library have not +yet been proven to support numerical computations as needed. As another +difference MTL currently does not seem to use expression templates. This +may result in one of two consequences: a possible loss of expressiveness +or a possible loss of performance. + +=== Concepts + +==== Mathematical Notation + +The usage of mathematical notation may ease the development of +scientific algorithms. So a C++ library implementing basic linear +algebra concepts carefully should overload selected C++ operators on +matrix and vector classes. + +We decided to use operator overloading for the following primitives: + +[cols="<,<",] +|=== +|Description |Operator + +|Indexing of vectors and matrices +|`vector::operator(size_t i); matrix::operator(size_t i, size_t j);` + +|Assignment of vectors and matrices +|`vector::operator = (const vector_expression &); vector::operator += (const vector_expression &); vector::operator -= (const vector_expression &); vector::operator *= (const scalar_expression &); matrix::operator = (const matrix_expression &); matrix::operator += (const matrix_expression &); matrix::operator -= (const matrix_expression &); matrix::operator *= (const scalar_expression &);` + +|Unary operations on vectors and matrices +|`vector_expression operator - (const vector_expression &); matrix_expression operator - (const matrix_expression &);` + +|Binary operations on vectors and matrices +|`vector_expression operator + (const vector_expression &, const vector_expression &); vector_expression operator - (const vector_expression &, const vector_expression &); matrix_expression operator + (const matrix_expression &, const matrix_expression &); matrix_expression operator - (const matrix_expression &, const matrix_expression &);` + +|Multiplication of vectors and matrices with a scalar +|`vector_expression operator * (const scalar_expression &, const vector_expression &); vector_expression operator * (const vector_expression &, const scalar_expression &); matrix_expression operator * (const scalar_expression &, const matrix_expression &); matrix_expression operator * (const matrix_expression &, const scalar_expression &);` +|=== + +We decided to use no operator overloading for the following other +primitives: + +[cols="<,<",] +|=== +|Description |Function + +|Left multiplication of vectors with a matrix +|`vector_expression prod (const matrix_expression &, const vector_expression &); vector_expression prod (const matrix_expression &, const vector_expression &);` + +|Right multiplication of vectors with a matrix +|`vector_expression prod (const vector_expression &, const matrix_expression &); vector_expression prod (const vector_expression &, const matrix_expression &);` + +|Multiplication of matrices |`matrix_expression prod (const matrix_expression &, const matrix_expression &); matrix_expression prod (const matrix_expression &, const matrix_expression &);` + +|Inner product of vectors +|`scalar_expression inner_prod (const vector_expression &, const vector_expression &);` + +|Outer product of vectors +|`matrix_expression outer_prod (const vector_expression &, const vector_expression &);` + +|Transpose of a matrix +|`matrix_expression trans (const matrix_expression &);` +|=== + +==== Efficiency + +To achieve the goal of efficiency for numerical computing, one has to +overcome two difficulties in formulating abstractions with C++, namely +temporaries and virtual function calls. Expression templates solve these +problems, but tend to slow down compilation times. + +===== Eliminating Temporaries + +Abstract formulas on vectors and matrices normally compose a couple of +unary and binary operations. The conventional way of evaluating such a +formula is first to evaluate every leaf operation of a composition into +a temporary and next to evaluate the composite resulting in another +temporary. This method is expensive in terms of time especially for +small and space especially for large vectors and matrices. The approach +to solve this problem is to use lazy evaluation as known from modern +functional programming languages. The principle of this approach is to +evaluate a complex expression element wise and to assign it directly to +the target. + +Two interesting and dangerous facts result: + +===== Aliases + +One may get serious side effects using element wise evaluation on +vectors or matrices. Consider the matrix vector product _x = A x_. +Evaluation of __A__~_1_~_x_ and assignment to __x__~_1_~ changes the +right hand side, so that the evaluation of __A__~_2_~_x_ returns a wrong +result. In this case there are *aliases* of the elements __x__~_n_~ on +both the left and right hand side of the assignment. + +Our solution for this problem is to evaluate the right hand side of an +assignment into a temporary and then to assign this temporary to the +left hand side. To allow further optimizations, we provide a +corresponding member function for every assignment operator and also a +link:operations_overview.html#noalias[`noalias` syntax.] By using this +syntax a programmer can confirm, that the left and right hand sides of +an assignment are independent, so that element wise evaluation and +direct assignment to the target is safe. + +===== Complexity + +The computational complexity may be unexpectedly large under certain +cirumstances. Consider the chained matrix vector product _A (B x)_. +Conventional evaluation of _A (B x)_ is quadratic. Deferred evaluation +of __B x__~_i_~ is linear. As every element __B x__~_i_~ is needed +linearly depending of the size, a completely deferred evaluation of the +chained matrix vector product _A (B x)_ is cubic. In such cases one +needs to reintroduce temporaries in the expression. + +===== Eliminating Virtual Function Calls + +Lazy expression evaluation normally leads to the definition of a class +hierarchy of terms. This results in the usage of dynamic polymorphism to +access single elements of vectors and matrices, which is also known to +be expensive in terms of time. A solution was found a couple of years +ago independently by David Vandervoorde and Todd Veldhuizen and is +commonly called expression templates. Expression templates contain lazy +evaluation and replace dynamic polymorphism with static, i.e. compile +time polymorphism. Expression templates heavily depend on the famous +Barton-Nackman trick, also coined 'curiously defined recursive +templates' by Jim Coplien. + +Expression templates form the base of our implementation. + +===== Compilation times + +It is also a well known fact, that expression templates challenge +currently available compilers. We were able to significantly reduce the +amount of needed expression templates using the Barton-Nackman trick +consequently. + +We also decided to support a dual conventional implementation (i.e. not +using expression templates) with extensive bounds and type checking of +vector and matrix operations to support the development cycle. Switching +from debug mode to release mode is controlled by the `NDEBUG` +preprocessor symbol of ``. + +Functionality + +Every C++ library supporting linear algebra will be measured against the +long-standing Fortran package BLAS. We now describe how BLAS calls may +be mapped onto our classes. + +The page link:operations_overview.html[Overview of Matrix and Vector +Operations] gives a short summary of the most used operations on vectors +and matrices. + +===== Blas Level 1 + +[width="100%",cols="<25%,<25%,<25%,<25%",] +|=== +|BLAS Call |Mapped Library Expression |Mathematical Description |Comment + +|`sasum` OR `dasum` |`norm_1 (x)` |`sum(mod(x~i~))` |Computes the _l~1~_ +(sum) norm of a real vector. + +|`scasum` OR `dzasum` |`real (sum (v)) + imag (sum (v))` |`_sum +re(x~i~) + sum im(x~i~)_` |Computes the sum of elements of a complex +vector. + +|`_nrm2` |`norm_2 (x)` |`sqrt ((sum(mod(x~i~)^_2_^)))` |Computes the +_l~2~_ (euclidean) norm of a vector. + +|`i_amax` |`norm_inf (x) index_norm_inf (x)` |`max(mod(x~i~))` +|Computes the _l~inf~_ (maximum) norm of a vector. + +BLAS computes the index of the first element having this value. + +|`_dot _dotu _dotc` |`inner_prod (x, y)` or `inner_prod (conj (x), y)` +|__x__^_T_^ _y_ or + +__x__^_H_^ _y_ |Computes the inner product of two vectors. + +BLAS implements certain loop unrollment. + +|`dsdot sdsdot` |`a + prec_inner_prod (x, y)` |__a + x__^_T_^ _y_ +|Computes the inner product in double precision. + +|`_copy` |`x = y y.assign (x)` |_x <- y_ |Copies one vector to +another. + +BLAS implements certain loop unrollment. + +|`_swap` |`swap (x, y)` |_x <--> y_ |Swaps two vectors. + +BLAS implements certain loop unrollment. + +|`_scal csscal zdscal` |`x *= a` |_x <- a x_ |Scales a vector. + +BLAS implements certain loop unrollment. + +|`_axpy` |`y += a * x` |_y <- a x + y_ |Adds a scaled vector. + +BLAS implements certain loop unrollment. + +|`_rot _rotm csrot zdrot` +|`t.assign (a * x + b * y), y.assign (- b * x + a * y), x.assign (t)` +|_(x, y) <- (a x + b y, -b x + a y)_ |Applies a plane rotation. + +|`_rotg _rotmg` |  |__(a, b) <- + +  (? a / sqrt (a__^_2_^ + __b__^_2_^__), + +    ? b / sqrt (a__^_2_^ + __b__^_2_^_))_ or__ + +(1, 0) <- (0, 0)__ |Constructs a plane rotation. +|=== + +===== Blas Level 2 + +[width="100%",cols="<25%,<25%,<25%,<25%",] +|=== +|BLAS Call |Mapped Library Expression |Mathematical Description |Comment + +|`_t_mv` |`x = prod (A, x)` or `x = prod (trans (A), x)` or `x = prod (herm (A), x)` |_x <- A x_ or__ + x <- A__^_T_^ _x_ or__ + x <- A__^_H_^ _x_ |Computes the product of a matrix with a vector. + +|`_t_sv` |`y = solve (A, x, tag)` or + +`inplace_solve (A, x, tag)` or + +`y = solve (trans (A), x, tag)` or + +`inplace_solve (trans (A), x, tag)` or + +`y = solve (herm (A), x, tag)`or + +`inplace_solve (herm (A), x, tag)` |__y <- A__^_-1_^ _x_ or__ + +x <- A__^_-1_^ _x_ or__ + +y <- A^_T_^^_-1_^ _x_ or__ + +x <- A^_T_^^_-1_^ _x_ or__ + +y <- A^_H_^^_-1_^ _x_ or__ + +x <- A^_H_^^_-1_^ _x_ +|Solves a system of linear equations with triangular form, i.e. _A_ is +triangular. + +|`_g_mv _s_mv _h_mv` + +|`y = a * prod (A, x) + b * y` or` y = a * prod (trans (A), x) + b * y` +or` y = a * prod (herm (A), x) + b * y` + +|_y <- a A x + b y_ or__ + +y <- a A__^_T_^ __x + b y + +y <- a A__^_H_^ _x + b y_ + +|Adds the scaled product of a matrix with a vector. + +|`_g_r _g_ru _g_rc` + +|`A += a * outer_prod (x, y)` or` A += a * outer_prod (x, conj (y))` + +|__A <- a x y__^_T_^ _+ A_ or__ + +A <- a x y__^_H_^ _+ A_ + +|Performs a rank _1_ update. + +|`_s_r _h_r` + +|`A += a * outer_prod (x, x)` or` A += a * outer_prod (x, conj (x))` + +|__A <- a x x__^_T_^ _+ A_ or__ + +A <- a x x__^_H_^ _+ A_ + +|Performs a symmetric or hermitian rank _1_ update. + +|`_s_r2 _h_r2` + +|`A += a * outer_prod (x, y) +  a * outer_prod (y, x))` +or` A += a * outer_prod (x, conj (y)) +  conj (a) * outer_prod (y, conj (x)))` + +|__A <- a x y__^_T_^ __+ a y x__^_T_^ _+ A_ or__ + +A <- a x y__^_H_^ __+ a__^_-_^ __y x__^_H_^ _+ A_ + +|Performs a symmetric or hermitian rank _2_ update. + +|=== + +===== Blas Level 3 + +[width="100%",cols="<25%,<25%,<25%,<25%",] +|=== +|BLAS Call |Mapped Library Expression |Mathematical Description |Comment + +|`_t_mm` |`B = a * prod (A, B)` or + +`B = a * prod (trans (A), B)` or + +`B = a * prod (A, trans (B))` or + +`B = a * prod (trans (A), trans (B))` or + +`B = a * prod (herm (A), B)` or + +`B = a * prod (A, herm (B))` or + +`B = a * prod (herm (A), trans (B))` or + +`B = a * prod (trans (A), herm (B))` or + +`B = a * prod (herm (A), herm (B))` |_B <- a op (A) op (B)_ with + +  _op (X) = X_ or + +  __op (X) = X__^_T_^ or + +  __op (X) = X__^_H_^ |Computes the scaled product of two matrices. + +|`_t_sm` |`C = solve (A, B, tag)` or + +`inplace_solve (A, B, tag)` or + +`C = solve (trans (A), B, tag)` or` inplace_solve (trans (A), B, tag)` +or` C = solve (herm (A), B, tag)` or` inplace_solve (herm (A), B, tag)` +|__C <- A__^_-1_^ _B_ or__ + +B <- A__^_-1_^ _B_ or__ + +C <- _A_^_T_^^_-1_^ _B_ or__ + +B <- _A_^_-1_^ _B_ or__ + +C <- _A_^_H_^^_-1_^ _B_ or__ + +B <- _A_^_H_^^_-1_^ _B_ |Solves a system of linear equations with +triangular form, i.e. _A_ is triangular. + +|`_g_mm _s_mm _h_mm` |`C = a * prod (A, B) + b * C` or + +`C = a * prod (trans (A), B) + b * C` or + +`C = a * prod (A, trans (B)) + b * C` or + +`C = a * prod (trans (A), trans (B)) + b * C` or + +`C = a * prod (herm (A), B) + b * C` or + +`C = a * prod (A, herm (B)) + b * C` or + +`C = a * prod (herm (A), trans (B)) + b * C` or + +`C = a * prod (trans (A), herm (B)) + b * C` or + +`C = a * prod (herm (A), herm (B)) + b * C` |_C <- a op (A) op (B) + b +C_ with + +  _op (X) = X_ or + +  __op (X) = X__^_T_^ or + +  __op (X) = X__^_H_^ |Adds the scaled product of two matrices. + +|`_s_rk _h_rk` |`B = a * prod (A, trans (A)) + b * B` or + +`B = a * prod (trans (A), A) + b * B` or + +`B = a * prod (A, herm (A)) + b * B` or + +`B = a * prod (herm (A), A) + b * B` |__B <- a A A__^_T_^ _+ b B_ or__ + +B <- a A__^_T_^ _A + b B_ or + +__B <- a A A__^_H_^ _+ b B_ or__ + +B <- a A__^_H_^ _A + b B_ |Performs a symmetric or hermitian rank _k_ +update. + +|`_s_r2k _h_r2k` +|`C = a * prod (A, trans (B)) +  a * prod (B, trans (A)) + b * C` or + +`C = a * prod (trans (A), B) +  a * prod (trans (B), A) + b * C` or + +`C = a * prod (A, herm (B)) +  conj (a) * prod (B, herm (A)) + b * C` +or + +`C = a * prod (herm (A), B) +  conj (a) * prod (herm (B), A) + b * C` +|__C <- a A B__^_T_^ __+ a B A__^_T_^ _+ b C_ or__ + +C <- a A__^_T_^ __B + a B__^_T_^ _A + b C_ or__ + +C <- a A B__^_H_^ __+ a__^_-_^ __B A__^_H_^ _+ b C_ or__ + +C <- a A__^_H_^ __B + a__^_-_^ __B__^_H_^ _A + b C_ |Performs a +symmetric or hermitian rank _2 k_ update. +|=== + +=== Storage Layout + +uBLAS supports many different storage layouts. The full details can be +found at the link:types_overview.html[Overview of Types]. Most types +like `vector` and `matrix` are by default compatible to +C arrays, but can also be configured to contain FORTAN compatible data. + +=== Compatibility + +For compatibility reasons we provide array like indexing for vectors and +matrices. For some types (hermitian, sparse etc) this can be expensive +for matrices due to the needed temporary proxy objects. + +uBLAS uses STL compatible allocators for the allocation of the storage +required for it's containers. + +=== Benchmark Results + +The following tables contain results of one of our benchmarks. This +benchmark compares a native C implementation ('C array') and some +library based implementations. The safe variants based on the library +assume aliasing, the fast variants do not use temporaries and are +functionally equivalent to the native C implementation. Besides the +generic vector and matrix classes the benchmark utilizes special classes +`c_vector` and `c_matrix`, which are intended to avoid every overhead +through genericity. + +The benchmark program *bench1* was compiled with GCC 4.0 and run on an +Athlon 64 3000+. Times are scales for reasonable precision by running +*bench1 100*. + +First we comment the results for double vectors and matrices of +dimension 3 and 3 x 3, respectively. + +[cols="<,,,,",] +|=== +|Comment | | | | + +|inner_prod |C array |0.61 |782 |Some abstraction penalty + +| |c_vector | |0.86 |554 + +| |vector | |1.02 |467 + +|vector + vector |C array |0.51 |1122 |Abstraction penalty: factor 2 + +| |c_vector fast | |1.17 |489 + +| |vector fast | |1.32 |433 + +| |c_vector safe | |2.02 |283 + +| |vector safe | |6.95 |82 + +|outer_prod |C array |0.59 |872 |Some abstraction penalty + +| |c_matrix, c_vector fast | |0.88 |585 + +| |matrix, vector fast | |0.90 |572 + +| |c_matrix, c_vector safe | |1.66 |310 + +| |matrix, vector safe | |2.95 |175 + +|prod (matrix, vector) |C array |0.64 |671 |No significant abstraction +penalty + +| |c_matrix, c_vector fast | |0.70 |613 + +| |matrix, vector fast | |0.79 |543 + +| |c_matrix, c_vector safe | |0.95 |452 + +| |matrix, vector safe | |2.61 |164 + +|matrix + matrix |C array |0.75 |686 |No significant abstraction penalty + +| |c_matrix fast | |0.99 |520 + +| |matrix fast | |1.29 |399 + +| |c_matrix safe | |1.7 |303 + +| |matrix safe | |3.14 |164 + +|prod (matrix, matrix) |C array |0.94 |457 |No significant abstraction +penalty + +| |c_matrix fast | |1.17 |367 + +| |matrix fast | |1.34 |320 + +| |c_matrix safe | |1.56 |275 + +| |matrix safe | |2.06 |208 +|=== + +We notice a two fold performance loss for small vectors and matrices: +first the general abstraction penalty for using classes, and then a +small loss when using the generic vector and matrix classes. The +difference w.r.t. alias assumptions is also significant. + +Next we comment the results for double vectors and matrices of dimension +100 and 100 x 100, respectively. + +[cols="<,<,<,<,<",] +|=== +|Operation |Implementation |Elapsed [s] |MFLOP/s |Comment + +|inner_prod |C array |0.64 |889 |No significant abstraction penalty + +| |c_vector | |0.66 |862 + +| |vector | |0.66 |862 + +|vector + vector |C array |0.64 |894 |No significant abstraction penalty + +| |c_vector fast | |0.66 |867 + +| |vector fast | |0.66 |867 + +| |c_vector safe | |1.14 |501 + +| |vector safe | |1.23 |465 + +|outer_prod |C array |0.50 |1144 |No significant abstraction penalty + +| |c_matrix, c_vector fast | |0.71 |806 + +| |matrix, vector fast | |0.57 |1004 + +| |c_matrix, c_vector safe | |1.91 |300 + +| |matrix, vector safe | |0.89 |643 + +|prod (matrix, vector) |C array |0.65 |876 |No significant abstraction +penalty + +| |c_matrix, c_vector fast | |0.65 |876 + +| |matrix, vector fast | |0.66 |863 + +| |c_matrix, c_vector safe | |0.66 |863 + +| |matrix, vector safe | |0.66 |863 + +|matrix + matrix |C array |0.96 |596 |No significant abstraction penalty + +| |c_matrix fast | |1.21 |473 + +| |matrix fast | |1.00 |572 + +| |c_matrix safe | |2.44 |235 + +| |matrix safe | |1.30 |440 + +|prod (matrix, matrix) |C array |0.70 |813 |No significant abstraction +penalty + +| |c_matrix fast | |0.73 |780 + +| |matrix fast | |0.76 |749 + +| |c_matrix safe | |0.75 |759 + +| |matrix safe | |0.76 |749 +|=== + +For larger vectors and matrices the general abstraction penalty for +using classes seems to decrease, the small loss when using generic +vector and matrix classes seems to remain. The difference w.r.t. alias +assumptions remains visible, too. + +''''' + +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 ). diff --git a/doc/ublas/products.adoc b/doc/ublas/products.adoc new file mode 100644 index 000000000..5c7af1a59 --- /dev/null +++ b/doc/ublas/products.adoc @@ -0,0 +1,200 @@ +== Special Products + +[[toc]] + +=== Functions + +[width="100%",cols=">50%,50%",] +|=== +|template BOOST_UBLAS_INLINE V & +|link:#product_1[axpy_prod] (const matrix_expression< E1 > &e1, const vector_expression< E2 > &e2, V &v, bool init=true) computes `v += A x` or `v = A x` in an optimized fashion. + +|template BOOST_UBLAS_INLINE V & +|link:#product_2[axpy_prod] (const vector_expression< E1 > &e1, const matrix_expression< E2 > &e2, V &v, bool init=true) computes `v += AT x` or `v = AT x` in an optimized fashion. + +|template BOOST_UBLAS_INLINE M & +|link:#product_3[axpy_prod] (const matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, bool init=true) computes `M += A X` or `M = A X` in an optimized fashion. + +|template BOOST_UBLAS_INLINE M & +|link:#product_4[opb_prod] (const matrix_expression< E1 > &e1, const matrix_expression< E2 > &e2, M &m, bool init=true) computes `M += A X` or `M = A X` in an optimized fashion. +|=== + +''''' + +[#product_1]#1.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!BOOST_UBLAS_INLINE V& axpy_prod !( !const matrix_expression< E1 > & +!_e1_, + +! ! !const vector_expression< E2 > & !_e2_, + +! ! !V & !_v_, + +! ! !bool !_init_ = `true` + +! !) ! ! +!=== + +|=== + +[width="100%",cols="50%,50%",] +|=== +| a| +computes `v += A x` or `v = A x` in an optimized fashion. + +*Parameters:*:: + _e1_ the matrix expression `A`, + _e2_ the vector expression `x`, + _v_ the result vector `v`, + _init_ a boolean parameter + + +`axpy_prod(A, x, v, init)` implements the well known axpy-product. +Setting _init_ to `true` is equivalent to call `v.clear()` before +`axpy_prod`. Currently _init_ defaults to `true`, but this may change in +the future. + +Up to now there are some specialisation for compressed matrices that +give a large speed up compared to prod. + +|=== + +[#product_2]#2.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!BOOST_UBLAS_INLINE V& axpy_prod !( !const vector_expression< E1 > & +!_e1_, + +! ! !const matrix_expression< E2 > & !_e2_, + +! ! !V & !_v_, + +! ! !bool !_init_ = `true` + +! !) ! ! +!=== + +|=== + +[width="100%",cols="50%,50%",] +|=== +| a| +computes `v += AT x` or `v = AT x` in an optimized fashion. + +*Parameters:*:: + _e1_ the vector expression `x`, + _e2_ the matrix expression `A`, + _v_ the result vector `v`, + _init_ a boolean parameter + +`axpy_prod(x, A, v, init)` implements the well known axpy-product. +Setting _init_ to `true` is equivalent to call `v.clear()` before +`axpy_prod`. Currently _init_ defaults to `true`, but this may change in +the future. + +Up to now there are some specialisation for compressed matrices that +give a large speed up compared to prod. + +|=== + +[#product_3]#3.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!BOOST_UBLAS_INLINE M& axpy_prod !( !const matrix_expression< E1 > & +!_e1_, + +! ! !const matrix_expression< E2 > & !_e2_, + +! ! !M & !_m_, + +! ! !bool !_init_ = `true` + +! !) ! ! +!=== + +|=== + +[width="100%",cols="50%,50%",] +|=== +| a| +computes `M += A X` or `M = A X` in an optimized fashion. + +*Parameters:*:: + _e1_ !the matrix expression `A`, + _e2_ !the matrix expression `X`, + _m_ !the result matrix `M`, + _init_ !a boolean parameter + + +`axpy_prod(A, X, M, init)` implements the well known axpy-product. +Setting _init_ to `true` is equivalent to call `M.clear()` before +`axpy_prod`. Currently _init_ defaults to `true`, but this may change in +the future. + +Up to now there are no specialisations. + +|=== + +[#product_4]#4.# + +[width="100%",cols="100%",] +|=== +a| +[cols=",,,",] +!=== +!BOOST_UBLAS_INLINE M& opb_prod !( !const matrix_expression< E1 > & +!_e1_, + +! ! !const matrix_expression< E2 > & !_e2_, + +! ! !M & !_m_, + +! ! !bool !_init_ = `true` + +! !) ! ! +!=== + +|=== + +[width="100%",cols="50%,50%",] +|=== +| a| +computes `M += A X` or `M = A X` in an optimized fashion. + +*Parameters:*:: + _e1_ the matrix expression `A` + _e2_ the matrix expression `X` + _m_ the result matrix `M` + _init_ a boolean parameter + +`opb_prod(A, X, M, init)` implements the well known axpy-product. +Setting _init_ to `true` is equivalent to call `M.clear()` before +`opb_prod`. Currently _init_ defaults to `true`, but this may change in +the future. + +This function may give a speedup if `A` has less columns than rows, +because the product is computed as a sum of outer products. + +|=== + +''''' + +Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, Joerg Walter, +Gunter Winkler + +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 ). \ No newline at end of file diff --git a/doc/ublas/range.adoc b/doc/ublas/range.adoc new file mode 100644 index 000000000..ad2e8b869 --- /dev/null +++ b/doc/ublas/range.adoc @@ -0,0 +1,191 @@ +== Range and Slice Storage + +[[toc]] + +=== [#range]#Range# + +==== Description + +The class `range` specifies a range of indicies. The range is a sequence +of indices from a start value to stop value. The indices increase by one +and exlude the stop value. `range` can therefore be used to specify +ranges of elements from vectors and matrices. + +==== Example + +[source, cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + range r (0, 3); + for (unsigned i = 0; i < r.size (); ++ i) { + std::cout << r (i) << std::endl; + } +} +.... + +==== Definition + +Defined in the header storage.hpp. + +==== Model of + +Reversible Container. + +==== Type requirements + +None, except for those imposed by the requirements of Reversible +Container. + +==== Public base classes + +None. + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`range (size_type start, size_type stop)` |Constructs a range of +indicies from `start` to `stop (excluded)` . + +|`size_type start () const` |Returns the beginning of the `range`. + +|`size_type size () const` |Returns the size of the `range`. + +|`const_reference operator [] (size_type i) const` |Returns the value +`start + i` of the `i` -th element. + +|`range compose (const range &r) const` |Returns the composite range +from `start + r.start ()` to `start + r.start () + r.size ()`. + +|`bool operator == (const range &r) const` |Tests two ranges for +equality. + +|`bool operator != (const range &r) const` |Tests two ranges for +inequality. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `range`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `range`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`range`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed `range`. +|=== + +==== Preconditions + +* `start () < = stop ()` + +=== [#slice]#Slice# + +==== Description + +The class `slice` specifies a 'slice' of indicies. Slices are more +general then ranges, the stride allows the sequence of indicies to +increase and decrease by the specified amount between element. `slice` +can therefore be used to specify slices of element from vectors and +matrices. + +==== Example + +[source,cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + slice s (0, 1, 3); + for (unsigned i = 0; i < s.size (); ++ i) { + std::cout << s (i) << std::endl; + } +} +.... + +==== Definition + +Defined in the header storage.hpp. + +==== Model of + +Reversible Container. + +==== Type requirements + +None, except for those imposed by the requirements of Reversible +Container. + +==== Public base classes + +None. + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`slice (size_type start, size_type stride, size_type size)` |Constructs +a slice `start,start+stride,start+2*stride...` with `size` elements. + +|`size_type start () const` |Returns the beginning of the `slice`. + +|`size_type stride () const` |Returns the stride of the `slice`. + +|`size_type size () const` |Returns the size of the `slice`. + +|`const_reference operator [] (size_type i) const` |Returns the value +`start + i * stride` of the `i`-th element. + +|`slice compose (const range &r) const` |Returns the composite slice +from `start + stride * r.start ()` to +`start + stride * (r.start () + r.size ())` with stride `stride`. + +|`slice compose (const slice &s) const` |Returns the composite slice +from `start + stride * s.start ()` to +`start + stride * s.stride () * (s.start () + s.size ())` with stride +`stride * s.stride ()` . + +|`bool operator == (const slice &s) const` |Tests two slices for +equality. + +|`bool operator != (const slice &s) const` |Tests two slices for +inequality. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `slice`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `slice`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`slice`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed `slice`. +|=== + +==== Preconditions + +* None all strides are vaild. However when an index is returned or an +iterator is dereferenced its value must be representable as the +size_type. + +''''' + +Copyright (©) 2000-2004 Michael Stevens, Mathias Koch, Joerg Walter, +Gunter Winkler + +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 ). diff --git a/doc/ublas/release_notes.adoc b/doc/ublas/release_notes.adoc new file mode 100644 index 000000000..05fda74bc --- /dev/null +++ b/doc/ublas/release_notes.adoc @@ -0,0 +1,80 @@ +== Boost Basic Linear Algebra - Release Notes + +link:index.html[back to uBLAS home] + +[[toc]] + +=== Release 1.70.0 + +==== improvements + +* Add support for GPU-accelerated operations via +http://boostorg.github.io/compute/[Boost.Compute] +* Add support for a new (arbitrary-rank) tensor type and associated +operations. + +=== Release 1.52.0 + +==== improvements + +* https://svn.boost.org/trac/boost/ticket/4024[[4024]] improve +performance of inplace_solve +* https://svn.boost.org/trac/boost/ticket/6511[[6511]] Division by +scalar should use enable_if<> +* https://svn.boost.org/trac/boost/ticket/7297[[7297]] Make the free +functions 'num_columns' and 'num_rows' support the uBLAS traits system +and better work with expression types + +==== bug fixes + +* https://svn.boost.org/trac/boost/ticket/7296[[7296]] fixes and +improvements to test utility functions +* https://svn.boost.org/trac/boost/ticket/7363[[7363]] fixed +coordinate_matrix::sort() for gcc 4.7 and others + +=== Release 1.43.0 + +==== bug fixes + +* https://svn.boost.org/trac/boost/ticket/3968[[3968]] fixed +coordinate_matrix sort problem on MSVC10 +* https://svn.boost.org/trac/boost/ticket/3539[[3539]] changed +computation of `norm_inf` for complex types to match mathematical +definition. + +*Note:* This might cause a performance drop because now `std::abs(z)` is +called for each vector element. The old implementation used +`std::max(std::abs(real(z)),std::abs(imag(z))`. Further `norm_inf` and +`norm_1` will now return the same values for complex vector. +* https://svn.boost.org/trac/boost/ticket/3501[[3501]] Moved free +functions in `concepts.hpp` into anonymous namespace. + +=== Release 1.41.1 + +==== new features + +* Move semantics of vector/matrix container assignments have been +implemented. They can be enabled by setting BOOST_UBLAS_MOVE_SEMANTICS. +More details are on the link:options.html[preprocessor options page]. +* Introduce new free functions. See +https://svn.boost.org/trac/boost/ticket/3449[[3449]], the new tests in +libs/numeric/ublas/test and the inline documentation of the files in +boost/numeric/ublas/operation/. + +==== bug fixes + +* https://svn.boost.org/trac/boost/ticket/3293[[3293]] Fix resizing +problem in `identity_matrix` +* https://svn.boost.org/trac/boost/ticket/3499[[3499]] Add +DefaultConstructible to concept checks + +=== Release 1.40.0 and before + +* Release notes were not available in this form. + +''''' + +Copyright (©) 2000-2009 Joerg Walter, Mathias Koch, Gunter Winkler + +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 ). diff --git a/doc/samples/Jamfile.v2 b/doc/ublas/samples/Jamfile.v2 similarity index 100% rename from doc/samples/Jamfile.v2 rename to doc/ublas/samples/Jamfile.v2 diff --git a/doc/samples/assignment_examples.cpp b/doc/ublas/samples/assignment_examples.cpp similarity index 100% rename from doc/samples/assignment_examples.cpp rename to doc/ublas/samples/assignment_examples.cpp diff --git a/doc/samples/banded_adaptor.cpp b/doc/ublas/samples/banded_adaptor.cpp similarity index 100% rename from doc/samples/banded_adaptor.cpp rename to doc/ublas/samples/banded_adaptor.cpp diff --git a/doc/samples/banded_matrix.cpp b/doc/ublas/samples/banded_matrix.cpp similarity index 100% rename from doc/samples/banded_matrix.cpp rename to doc/ublas/samples/banded_matrix.cpp diff --git a/doc/samples/bounded_array.cpp b/doc/ublas/samples/bounded_array.cpp similarity index 100% rename from doc/samples/bounded_array.cpp rename to doc/ublas/samples/bounded_array.cpp diff --git a/doc/samples/compressed_matrix.cpp b/doc/ublas/samples/compressed_matrix.cpp similarity index 100% rename from doc/samples/compressed_matrix.cpp rename to doc/ublas/samples/compressed_matrix.cpp diff --git a/doc/samples/compressed_vector.cpp b/doc/ublas/samples/compressed_vector.cpp similarity index 100% rename from doc/samples/compressed_vector.cpp rename to doc/ublas/samples/compressed_vector.cpp diff --git a/doc/samples/coordinate_matrix.cpp b/doc/ublas/samples/coordinate_matrix.cpp similarity index 100% rename from doc/samples/coordinate_matrix.cpp rename to doc/ublas/samples/coordinate_matrix.cpp diff --git a/doc/samples/coordinate_vector.cpp b/doc/ublas/samples/coordinate_vector.cpp similarity index 100% rename from doc/samples/coordinate_vector.cpp rename to doc/ublas/samples/coordinate_vector.cpp diff --git a/doc/samples/ex_triangular.cpp b/doc/ublas/samples/ex_triangular.cpp similarity index 100% rename from doc/samples/ex_triangular.cpp rename to doc/ublas/samples/ex_triangular.cpp diff --git a/doc/samples/hermitian_adaptor.cpp b/doc/ublas/samples/hermitian_adaptor.cpp similarity index 100% rename from doc/samples/hermitian_adaptor.cpp rename to doc/ublas/samples/hermitian_adaptor.cpp diff --git a/doc/samples/hermitian_matrix.cpp b/doc/ublas/samples/hermitian_matrix.cpp similarity index 100% rename from doc/samples/hermitian_matrix.cpp rename to doc/ublas/samples/hermitian_matrix.cpp diff --git a/doc/samples/identity_matrix.cpp b/doc/ublas/samples/identity_matrix.cpp similarity index 100% rename from doc/samples/identity_matrix.cpp rename to doc/ublas/samples/identity_matrix.cpp diff --git a/doc/samples/map_array.cpp b/doc/ublas/samples/map_array.cpp similarity index 100% rename from doc/samples/map_array.cpp rename to doc/ublas/samples/map_array.cpp diff --git a/doc/samples/mapped_matrix.cpp b/doc/ublas/samples/mapped_matrix.cpp similarity index 100% rename from doc/samples/mapped_matrix.cpp rename to doc/ublas/samples/mapped_matrix.cpp diff --git a/doc/samples/mapped_vector.cpp b/doc/ublas/samples/mapped_vector.cpp similarity index 100% rename from doc/samples/mapped_vector.cpp rename to doc/ublas/samples/mapped_vector.cpp diff --git a/doc/samples/matrix.cpp b/doc/ublas/samples/matrix.cpp similarity index 100% rename from doc/samples/matrix.cpp rename to doc/ublas/samples/matrix.cpp diff --git a/doc/samples/matrix_binary.cpp b/doc/ublas/samples/matrix_binary.cpp similarity index 100% rename from doc/samples/matrix_binary.cpp rename to doc/ublas/samples/matrix_binary.cpp diff --git a/doc/samples/matrix_binary_scalar.cpp b/doc/ublas/samples/matrix_binary_scalar.cpp similarity index 100% rename from doc/samples/matrix_binary_scalar.cpp rename to doc/ublas/samples/matrix_binary_scalar.cpp diff --git a/doc/samples/matrix_column.cpp b/doc/ublas/samples/matrix_column.cpp similarity index 100% rename from doc/samples/matrix_column.cpp rename to doc/ublas/samples/matrix_column.cpp diff --git a/doc/samples/matrix_column_project.cpp b/doc/ublas/samples/matrix_column_project.cpp similarity index 100% rename from doc/samples/matrix_column_project.cpp rename to doc/ublas/samples/matrix_column_project.cpp diff --git a/doc/samples/matrix_matrix_binary.cpp b/doc/ublas/samples/matrix_matrix_binary.cpp similarity index 100% rename from doc/samples/matrix_matrix_binary.cpp rename to doc/ublas/samples/matrix_matrix_binary.cpp diff --git a/doc/samples/matrix_matrix_solve.cpp b/doc/ublas/samples/matrix_matrix_solve.cpp similarity index 100% rename from doc/samples/matrix_matrix_solve.cpp rename to doc/ublas/samples/matrix_matrix_solve.cpp diff --git a/doc/samples/matrix_range.cpp b/doc/ublas/samples/matrix_range.cpp similarity index 100% rename from doc/samples/matrix_range.cpp rename to doc/ublas/samples/matrix_range.cpp diff --git a/doc/samples/matrix_range_project.cpp b/doc/ublas/samples/matrix_range_project.cpp similarity index 100% rename from doc/samples/matrix_range_project.cpp rename to doc/ublas/samples/matrix_range_project.cpp diff --git a/doc/samples/matrix_row.cpp b/doc/ublas/samples/matrix_row.cpp similarity index 100% rename from doc/samples/matrix_row.cpp rename to doc/ublas/samples/matrix_row.cpp diff --git a/doc/samples/matrix_row_project.cpp b/doc/ublas/samples/matrix_row_project.cpp similarity index 100% rename from doc/samples/matrix_row_project.cpp rename to doc/ublas/samples/matrix_row_project.cpp diff --git a/doc/samples/matrix_slice.cpp b/doc/ublas/samples/matrix_slice.cpp similarity index 100% rename from doc/samples/matrix_slice.cpp rename to doc/ublas/samples/matrix_slice.cpp diff --git a/doc/samples/matrix_slice_project.cpp b/doc/ublas/samples/matrix_slice_project.cpp similarity index 100% rename from doc/samples/matrix_slice_project.cpp rename to doc/ublas/samples/matrix_slice_project.cpp diff --git a/doc/samples/matrix_unary.cpp b/doc/ublas/samples/matrix_unary.cpp similarity index 100% rename from doc/samples/matrix_unary.cpp rename to doc/ublas/samples/matrix_unary.cpp diff --git a/doc/samples/matrix_vector_binary.cpp b/doc/ublas/samples/matrix_vector_binary.cpp similarity index 100% rename from doc/samples/matrix_vector_binary.cpp rename to doc/ublas/samples/matrix_vector_binary.cpp diff --git a/doc/samples/matrix_vector_range.cpp b/doc/ublas/samples/matrix_vector_range.cpp similarity index 100% rename from doc/samples/matrix_vector_range.cpp rename to doc/ublas/samples/matrix_vector_range.cpp diff --git a/doc/samples/matrix_vector_slice.cpp b/doc/ublas/samples/matrix_vector_slice.cpp similarity index 100% rename from doc/samples/matrix_vector_slice.cpp rename to doc/ublas/samples/matrix_vector_slice.cpp diff --git a/doc/samples/matrix_vector_solve.cpp b/doc/ublas/samples/matrix_vector_solve.cpp similarity index 100% rename from doc/samples/matrix_vector_solve.cpp rename to doc/ublas/samples/matrix_vector_solve.cpp diff --git a/doc/samples/range.cpp b/doc/ublas/samples/range.cpp similarity index 100% rename from doc/samples/range.cpp rename to doc/ublas/samples/range.cpp diff --git a/doc/samples/slice.cpp b/doc/ublas/samples/slice.cpp similarity index 100% rename from doc/samples/slice.cpp rename to doc/ublas/samples/slice.cpp diff --git a/doc/samples/symmetric_adaptor.cpp b/doc/ublas/samples/symmetric_adaptor.cpp similarity index 100% rename from doc/samples/symmetric_adaptor.cpp rename to doc/ublas/samples/symmetric_adaptor.cpp diff --git a/doc/samples/symmetric_matrix.cpp b/doc/ublas/samples/symmetric_matrix.cpp similarity index 100% rename from doc/samples/symmetric_matrix.cpp rename to doc/ublas/samples/symmetric_matrix.cpp diff --git a/doc/samples/triangular_adaptor.cpp b/doc/ublas/samples/triangular_adaptor.cpp similarity index 100% rename from doc/samples/triangular_adaptor.cpp rename to doc/ublas/samples/triangular_adaptor.cpp diff --git a/doc/samples/triangular_matrix.cpp b/doc/ublas/samples/triangular_matrix.cpp similarity index 100% rename from doc/samples/triangular_matrix.cpp rename to doc/ublas/samples/triangular_matrix.cpp diff --git a/doc/samples/unbounded_array.cpp b/doc/ublas/samples/unbounded_array.cpp similarity index 100% rename from doc/samples/unbounded_array.cpp rename to doc/ublas/samples/unbounded_array.cpp diff --git a/doc/samples/unit_vector.cpp b/doc/ublas/samples/unit_vector.cpp similarity index 100% rename from doc/samples/unit_vector.cpp rename to doc/ublas/samples/unit_vector.cpp diff --git a/doc/samples/vector.cpp b/doc/ublas/samples/vector.cpp similarity index 100% rename from doc/samples/vector.cpp rename to doc/ublas/samples/vector.cpp diff --git a/doc/samples/vector_binary.cpp b/doc/ublas/samples/vector_binary.cpp similarity index 100% rename from doc/samples/vector_binary.cpp rename to doc/ublas/samples/vector_binary.cpp diff --git a/doc/samples/vector_binary_outer.cpp b/doc/ublas/samples/vector_binary_outer.cpp similarity index 100% rename from doc/samples/vector_binary_outer.cpp rename to doc/ublas/samples/vector_binary_outer.cpp diff --git a/doc/samples/vector_binary_redux.cpp b/doc/ublas/samples/vector_binary_redux.cpp similarity index 100% rename from doc/samples/vector_binary_redux.cpp rename to doc/ublas/samples/vector_binary_redux.cpp diff --git a/doc/samples/vector_binary_scalar.cpp b/doc/ublas/samples/vector_binary_scalar.cpp similarity index 100% rename from doc/samples/vector_binary_scalar.cpp rename to doc/ublas/samples/vector_binary_scalar.cpp diff --git a/doc/samples/vector_range.cpp b/doc/ublas/samples/vector_range.cpp similarity index 100% rename from doc/samples/vector_range.cpp rename to doc/ublas/samples/vector_range.cpp diff --git a/doc/samples/vector_range_project.cpp b/doc/ublas/samples/vector_range_project.cpp similarity index 100% rename from doc/samples/vector_range_project.cpp rename to doc/ublas/samples/vector_range_project.cpp diff --git a/doc/samples/vector_slice.cpp b/doc/ublas/samples/vector_slice.cpp similarity index 100% rename from doc/samples/vector_slice.cpp rename to doc/ublas/samples/vector_slice.cpp diff --git a/doc/samples/vector_slice_project.cpp b/doc/ublas/samples/vector_slice_project.cpp similarity index 100% rename from doc/samples/vector_slice_project.cpp rename to doc/ublas/samples/vector_slice_project.cpp diff --git a/doc/samples/vector_unary.cpp b/doc/ublas/samples/vector_unary.cpp similarity index 100% rename from doc/samples/vector_unary.cpp rename to doc/ublas/samples/vector_unary.cpp diff --git a/doc/samples/vector_unary_redux.cpp b/doc/ublas/samples/vector_unary_redux.cpp similarity index 100% rename from doc/samples/vector_unary_redux.cpp rename to doc/ublas/samples/vector_unary_redux.cpp diff --git a/doc/samples/zero_matrix.cpp b/doc/ublas/samples/zero_matrix.cpp similarity index 100% rename from doc/samples/zero_matrix.cpp rename to doc/ublas/samples/zero_matrix.cpp diff --git a/doc/samples/zero_vector.cpp b/doc/ublas/samples/zero_vector.cpp similarity index 100% rename from doc/samples/zero_vector.cpp rename to doc/ublas/samples/zero_vector.cpp diff --git a/doc/ublas/storage_concept.adoc b/doc/ublas/storage_concept.adoc new file mode 100644 index 000000000..dc85bc83c --- /dev/null +++ b/doc/ublas/storage_concept.adoc @@ -0,0 +1,109 @@ +== Storage concept + +[[toc]] + +=== [#range]#Storage concept# + +==== Description + +Storage is a variable-size container whose elements are arranged in a +strict linear order. + +Storage extends the STL Container concept with some STL Sequence-like +functionality. The main difference with the Sequence concept however is +that the Storage concept does not require default-initialisation of its +elements. + +==== Refinement of + +http://www.boost.org/sgi/stl/RandomAccessContainer.html[Random Access +Container] and +http://www.boost.org/sgi/stl/DefaultConstructible.html[Default +Constructible] + +==== Associated types + +No additional types beyond those defined by +http://www.boost.org/sgi/stl/RandomAccessContainer.html[Random Access +Container] + +==== Notation + +[cols=",",] +|=== +|X |A type that is model of Storage +|T |The value_type of X +|t |An object of type T +|n |object of type convertible to X::size_type +|=== + +==== Definitions + +==== Valid expressions + +In addition to the expressions defined in +http://www.boost.org/sgi/stl/RandomAccessContainer.html[Random Access +Container], and +http://www.boost.org/sgi/stl/DefaultConstructible.html[Default +Constructible] the following expressions must be valid: + +[cols=",,,",options="header",] +|=== +|Name |Expression |Type requirements |Return type +|Size constructor |X(n) |T is +http://www.boost.org/sgi/stl/DefaultConstructible.html[DefaultConstructible] +|X + +|Fill constructor |X(n,t) | |X + +|Range constructor |X(i, j) |i and j are +http://www.boost.org/sgi/stl/InputIterator.html[Input Iterators] whose +value type is convertible to T |X + +|Resize |a.resize(n, t) |a is mutable |void + +|Resize |a.resize(n) |a is mutable |void +|=== + +==== Expression semantics + +[cols=",,,,",options="header",] +|=== +|Name |Expression |Precondition |Semantics |Postcondition + +|Default-constructor |X() | |Creates 0 elements |size()==0 + +|Size-constructor |X(n) |n>=0 |Creates n elements. Elements are constructed without an initializer. +That is if T is a (possibly cv-qualified) non-POD class type (or array +thereof), the object is default initialized. Otherwise, the object +created has indeterminate value. See the sentance "If new initializer is +omitted" in section 5.3.4 paragraph 15 of the ISO C++ standard. |size()==n + +|Fill-constructor |X(n,t) |n>=0 |Creates n initialised element with copies of `t` |size()==n + +|Range constructor |X(i, j) |[i,j) is a valid range. |copies the range [i,j) to the storage |size() is equal to the distance from i to j. Each element is a copy of the corresponding element in the range [i,j). + +|Resize |a.resize(n, t) |n <= a.max_size() |Modified the container so that it has exactly n elements. + The container may be reallocated if its size changes. Existing element values are preserved, additional elements are copies of `t`. |a.size() == n + +|Resize |a.resize(n) |n <= a.max_size() |Modified the container so that it has exactly n elements. + The container may be reallocated if its size changes. Element values are uninitialised. That is, each element value may be a previously assigned value or default construced value for `T`. |a.size() == n + +|=== + +===== Complexity guarantees + +===== Invariants + +===== Models + +* link:unbounded_array.html[unbounded_array] +* link:bounded_array.html[bounded_array] + +===== Notes + +''''' + +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 ). diff --git a/doc/ublas/storage_sparse.adoc b/doc/ublas/storage_sparse.adoc new file mode 100644 index 000000000..884dac190 --- /dev/null +++ b/doc/ublas/storage_sparse.adoc @@ -0,0 +1,210 @@ +== Sparse Storage + +[[toc]] + +=== [#map_std]#Default Standard Map# + +==== Description + +The templated class `map_std` provides a wrapper for the +standard library associative container `std::map`. The wrapper has one +simple purpose. It allows the definition of a default template parameter +(for the adapted array) when declaring the sparse container types. + +==== Example + +[source, cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + map_std a (3); + for (unsigned i = 0; i < a.size (); ++ i) { + a [i] = i; + std::cout << a [i] << std::endl; + } +} +.... + +==== Definition + +Defined in the header storage_sparse.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`I` |The type of index stored in the array. | +|`T` |The type of object stored in the array. | +|`ALLOC` |An STL Allocator |std::allocator +|=== + +==== Model of + +Reversible Container. + +==== Type requirements + +None, except for those imposed by the requirements of Reversible +Container. + +==== Public base classes + +std::map + +=== [#map_array]#Map Array# + +==== Description + +The templated class `map_array` implements a `std::map` +like associative container as a sorted array. It therefore some of the +Associative Container interface without having the same semantics as an +std::map. + +At any time the `map_array` has a capacity up to which new element can +be inserted. If `insert` would cause the size of the `map_array` to +exceeds its capactity then it is *reallocated*. Iterators and reference +are invalidated. The capacity can be directly control using the +`reserve` member function. + +==== Example + +[source, cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + map_array a (3); + for (unsigned i = 0; i < a.size (); ++ i) { + a [i] = i; + std::cout << a [i] << std::endl; + } +} +.... + +==== Definition + +Defined in the header storage_sparse.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`I` |The type of index stored in the array. | +|`T` |The type of object stored in the array. | +|`ALLOC` |An STL Allocator |std::allocator +|=== + +==== Model of + +Reversible Container. + +==== Type requirements + +None, except for those imposed by the requirements of Reversible +Container. + +==== Public base classes + +None. + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`map_array (ALLOC &a = ALLOC())` |Allocates a `map_array` that holds at +most zero elements. + +|`map_array (const map_array &c)` |The copy constructor. + +|`~map_array ()` |Deallocates the `map_array` itself. + +|`void reserve (size_type capacity)` |Changes the`map_array` capacity. +It can hold at most`capacity` elements without reallocation. The +capacity can be reduced such that `capacity >= size()`. The content of +the`map_array` is preserved. + +|`size_type size () const` |Returns the size of the `map_array`. + +|`size_type size () const` |Returns the capacity of the `map_array`. + +|`data_reference operator [] (index_type i)` |Returns a reference of the +element that is associated with a particular index. If the `map_array` +does not already contain such an element, `operator[]` inserts the +default `T ()`. + +|`map_array &operator = (const map_array &a)` |The assignment operator. + +|`map_array &assign_temporary (map_array &a)` |Assigns a temporary. May +change the array `a`. + +|`void swap (map_array &a)` |Swaps the contents of the arrays. + +|`std::pair insert (const value_type &p)` |Inserts `p` into the array. +The second part of the return value is `true` if `p` was inserted and +`false` if was not inserted because it was aleady present. + +|`iterator insert (iterator it, const value_type &p)` |Inserts `p` into +the array, using `it` as a hint to where it will be inserted. + +|`void erase (iterator it)` |Erases the value at `it`. + +|`void clear ()` |Clears the array. + +|`const_iterator find (index_type i) const` |Finds an element whose +index is `i`. + +|`iterator find (index_type i)` |Finds an element whose index is `i`. + +|`const_iterator lower_bound (index_type i) const` |Finds the first +element whose index is not less than `i` . + +|`iterator lower_bound (index_type i)` |Finds the first element whose +index is not less than `i` . + +|`const_iterator upper_bound (index_type i) const` |Finds the first +element whose index is greater than `i` . + +|`iterator upper_bound (index_type i)` |Finds the first element whose +index is greater than `i` . + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `map_array`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `map_array`. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the `map_array`. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +`map_array`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`map_array`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`map_array`. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed `map_array`. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed `map_array`. +|=== + +''''' + +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 ). diff --git a/doc/ublas/symmetric.adoc b/doc/ublas/symmetric.adoc new file mode 100644 index 000000000..ddab2c6f8 --- /dev/null +++ b/doc/ublas/symmetric.adoc @@ -0,0 +1,401 @@ +== Symmetric Matrix + +[[toc]] + +=== [#symmetric_matrix]#Symmetric Matrix# + +==== Description + +The templated class `symmetric_matrix` is the base +container adaptor for symmetric matrices. For a _(n x n_ )-dimensional +symmetric matrix and _0 < = i < n_, _0 < = j < n_ holds __s__~_i,j_~= +__s__~_j,i_~. The storage of symmetric matrices is packed. + +==== Example + +[source, cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + symmetric_matrix 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 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 + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the matrix. | + +|`F1` |Functor describing the type of the symmetric matrix. +link:#symmetric_matrix_1[[1]] |`lower` + +|`F2` |Functor describing the storage organization. +link:#symmetric_matrix_2[[2]] |`row_major` + +|`A` |The type of the adapted array. link:#symmetric_matrix_3[[3]] +|`unbounded_array` +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`symmetric_matrix (size_type size)` |Allocates an uninitialized +`symmetric_matrix` that holds `size` rows of `size` elements. + +|`symmetric_matrix (const symmetric_matrix &m)` |The copy constructor. + +|`template symmetric_matrix (const matrix_expression &ae)` +|The extended copy constructor. + +|`void resize (size_type size, bool preserve = true)` |Reallocates a +`symmetric_matrix` to hold `size` rows of `size` elements. The existing +elements of the `symmetric_matrix` are preseved when specified. + +|`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. + +|`symmetric_matrix &operator = (const symmetric_matrix &m)` |The +assignment operator. + +|`symmetric_matrix &assign_temporary (symmetric_matrix &m)` |Assigns a +temporary. May change the symmetric matrix `m` . + +|`template symmetric_matrix &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template symmetric_matrix &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the symmetric matrix. Left and right +hand side of the assignment should be independent. + +|`template symmetric_matrix &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +symmetric matrix. + +|`template symmetric_matrix &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the symmetric matrix. Left and right hand +side of the assignment should be independent. + +|`template symmetric_matrix &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the symmetric matrix. + +|`template symmetric_matrix &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the symmetric matrix. Left and right +hand side of the assignment should be independent. + +|`template symmetric_matrix &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the symmetric matrix with a +scalar. + +|`template symmetric_matrix &operator /= (const AT &at)` |A +computed assignment operator. Divides the symmetric matrix through a +scalar. + +|`void swap (symmetric_matrix &m)` |Swaps the contents of the symmetric +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 `symmetric_matrix`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `symmetric_matrix`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `symmetric_matrix`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`symmetric_matrix`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `symmetric_matrix`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `symmetric_matrix`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `symmetric_matrix`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`symmetric_matrix`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`symmetric_matrix`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`symmetric_matrix`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `symmetric_matrix`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `symmetric_matrix`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`symmetric_matrix`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`symmetric_matrix`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `symmetric_matrix`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `symmetric_matrix`. +|=== + +==== Notes + +[#symmetric_matrix_1]#[1]# Supported parameters for the type of the +symmetric matrix are `lower` and `upper`. + +[#symmetric_matrix_2]#[2]# Supported parameters for the storage +organization are `row_major` and `column_major`. + +[#symmetric_matrix_3]#[3]# Supported parameters for the adapted array +are `unbounded_array` , `bounded_array` and `std::vector` . + +=== [#symmetric_adaptor]#Symmetric Adaptor# + +==== Description + +The templated class `symmetric_adaptor` is a symmetric matrix +adaptor for other matrices. + +==== Example + +[source, cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + symmetric_adaptor, 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, 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 + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`M` |The type of the adapted matrix. | + +|`F` |Functor describing the type of the symmetric adaptor. +link:#symmetric_adaptor_1[[1]] |`lower` +|=== + +==== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +==== Public base classes + +`matrix_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`symmetric_adaptor ()` |Constructs a `symmetric_adaptor` that holds +zero rows of zero elements. + +|`symmetric_adaptor (matrix_type &data)` |Constructs a +`symmetric_adaptor` of a matrix. + +|`symmetric_adaptor (const symmetric_adaptor &m)` |The copy constructor. + +|`template symmetric_adaptor (const matrix_expression &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. + +|`symmetric_adaptor &operator = (const symmetric_adaptor &m)` |The +assignment operator. + +|`symmetric_adaptor &assign_temporary (symmetric_adaptor &m)` |Assigns a +temporary. May change the symmetric adaptor `m`. + +|`template symmetric_adaptor &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template symmetric_adaptor &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the symmetric adaptor. Left and right +hand side of the assignment should be independent. + +|`template symmetric_adaptor &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +symmetric adaptor. + +|`template symmetric_adaptor &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the symmetric adaptor. Left and right hand +side of the assignment should be independent. + +|`template symmetric_adaptor &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the symmetric adaptor. + +|`template symmetric_adaptor &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the symmetric adaptor. Left and +right hand side of the assignment should be independent. + +|`template symmetric_adaptor &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the symmetric adaptor with a +scalar. + +|`template symmetric_adaptor &operator /= (const AT &at)` |A +computed assignment operator. Divides the symmetric adaptor through a +scalar. + +|`void swap (symmetric_adaptor &m)` |Swaps the contents of the symmetric +adaptors. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `symmetric_adaptor`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `symmetric_adaptor`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `symmetric_adaptor`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`symmetric_adaptor`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `symmetric_adaptor`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `symmetric_adaptor`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `symmetric_adaptor`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`symmetric_adaptor`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`symmetric_adaptor`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`symmetric_adaptor`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `symmetric_adaptor`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `symmetric_adaptor`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`symmetric_adaptor`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`symmetric_adaptor`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `symmetric_adaptor`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `symmetric_adaptor`. +|=== + +==== Notes + +[#symmetric_adaptor_1]#[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 ). diff --git a/doc/ublas/tensor.adoc b/doc/ublas/tensor.adoc new file mode 100644 index 000000000..43d0656bf --- /dev/null +++ b/doc/ublas/tensor.adoc @@ -0,0 +1,351 @@ +== Tensor + +[[toc]] + +. Tensor + +.. link:#tensor_1[Description] + +.. link:#tensor_2[Example] + +.. link:#tensor_3[Definition] + +.. link:#tensor_4[Model of] + +.. link:#tensor_5[Type requirements] + +.. link:#tensor_6[Public base classes] + +.. link:#tensor_7[Template parameters] + +.. link:#tensor_8[Member types] + +.. link:#tensor_9[Alias templates] + + +.. link:#tensor_10[Member Functions] + +... link:#tensor_11[Construction] + +... link:#tensor_12[Assignment] + +... link:#tensor_13[Capacity] + +... link:#tensor_14[Element access] + +... link:#tensor_15[Proxy Generation] + +... link:#tensor_16[Iterators] + +... link:#tensor_17[Modifiers] + +... link:#tensor_18[Notes] + + +==== a. [#tensor_1]#Description# + + +The templated class `tensor` is the base +container adaptor for dense tensors. Every element +$(t_/ i_1, i_2, \dots, i_p)$ of a $p$-order $(n_1 \times n_2 \times \cdots +\times n_p)$-dimensional tensor $T$ is mapped to $j$-th element of a +one-dimensional container where $(j = \sum_ /{r=1}^p i_r \cdot w_r)$ with +$1 \leq i_r \leq n_r $ for $1 \leq r \leq p$. For the first-order +orientation $w_1 = 1$ and $(w_k = n_{k-1} \cdot w_{k-1})$ for $k > 1$. +For last-order orientation $w_p = 1$ and $(w_k = n_/{k+1} \cdot w_/{k+1})$ for $k < p$. + +==== b. [#tensor_2]#Example# + +[source,cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + tensor t{4,2,3}; + for (auto k = 0ul; k < t.size (2); ++ k) + for (auto j = 0ul; j < t.size (1); ++ j) + for (auto i = 0ul; i < t.size (0); ++ i) + t.at(i,j,k) = 3*i + 2*j + 5*k; + + std::cout << t << std::endl; +} +.... + +==== c. [#tensor_3]#Definition# + +Defined in the header file `tensor/tensor.hpp`. + +==== d. [#tensor_4]#Model of# + +link:container_concept.html#tensor[Tensor] + +==== e. [#tensor_5]#Type requirements# + +None, except for those imposed by the requirements of +link:container_concept.html#tensor[Tensor] . + +==== f. [#tensor_6]#Public base classes# + +`tensor_container >` + +==== g. [#tensor_7]#Template parameters# + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`value_t` |The type of object stored in the tensor. | + +|`format_t` |Storage organization. link:#tensor_1[[1]] |`first_order` + +|`storage_t` |The type of the Storage array. link:#tensor_2[[2]] +|`std::vector` +|=== + +==== h. [#tensor_8]#Member types# + +[cols=",",] +|=== +|Member type |Description + +|`value_type` |Type `value_t` of the tensor elements. + +|`layout_type` |Format of the tensor which is either `first_order` or +`last_order`. + +|`array_type` |Sequence container type that stores all tensor elements +and is accessible with a single index. + +|`strides_type` |Type of the strides vector +`basic_strides` that stores all tensor elements +and is accessible with a single index. + +|`extents_type` |Type of the dimension extents vector `shape` that +stores all tensor elements and is accessible with a single index. + +|`size_type` |Unsigned integer which is usually `std::size_t`. + +|`difference_type` |Unsigned integer which is usually `std::ptrdiff_t`. + +|`reference` |Reference type `storage_type::reference` which is in most +cases `value_type&`. + +|`const_reference` |Constant reference type +`storage_type::const_reference` which is in most cases +`const value_type&`. + +|`pointer` |Pointer type `storage_type::pointer` which is in most cases +`value_type*`. + +|`const_pointer` |Constant reference type +`storage_type::const_reference` which is in most cases +`const value_type*`. + +|`iterator` |RandomAccessIterator `storage_type::iterator`. + +|`const_iterator` |Constant RandomAccessIterator +`storage_type::const_iterator`. + +|`reverse_iterator` |Reverse RandomAccessIterator +`storage_type::reverse_iterator`. + +|`const_reverse_iterator` |Reverse RandomAccessIterator +`storage_type::const_reverse_iterator`. + +|`matrix_type` |Type of the matrix +`matrix` with which the tensor type +interacts. + +|`vector_type` |Type of the vector +`matrix` with which the tensor type +interacts. +|=== + +==== i. [#tensor_9]#Alias templates# + +[cols=",",] +|=== +|Alias template |Description + +|`template using tensor_expression_type = detail::tensor_expression` |Type of link:tensor/tensor_expression.html#tensor_expression[tensor_expression] where `self_type` is the `tensor` type. + +|`template using matrix_expression_type = matrix_expression` |Type of link:matrix_expression.html#matrix_expression[matrix_expression]. + +|`template using vector_expression_type = vector_expression` |Type of link:vector_expression.html#vector_expression[vector_expression]. +|=== + +==== j. [#tensor_10]#Member Functions# + +===== i. [#tensor_11]#Construction# + +[cols=",",] +|=== +|Member function |Description + +|`tensor ()` |Constructs an uninitialized `tensor` that holds zero +elements. + +|`tensor (std::initializer_list list)` |Constructs an +uninitialized `tensor` where `list` specifies the dimension +link:tensor/extents.html[extents]. + +|`tensor (extents_type const& s)` |Constructs an uninitialized +`tensor` where `s` specifies the dimension +link:tensor/extents.html[extents]. + +|`tensor (extents_type const& e, array_type const& a)` |Constructs an +uninitialized `tensor` where `e` specifies the dimension +link:tensor/extents.html[extents] and `a` the data elements of the +tensor. + +|`tensor (tensor const& expr)` |Constructs +tensor by evaluating the link:tensor/tensor_expression.html[tensor +expression] `expr` and copying all elements of the result. + +|`tensor (matrix_expression_type const& expr)` |Constructs +tensor by evaluating the link:matrix_expression.html[matrix expression] +`expr` and copying all elements of the result. + +|`tensor (vector_expression_type const& expr)` |Constructs +tensor by evaluating the link:vector_expression.html[vector expression] +`expr` and copying all elements of the result. +|=== + +===== ii. [#tensor_12]#Assignment# + +[cols=",",] +|=== +|Member function |Description + +|`tensor& operator=(tensor_expression_type const& expr)` +|Evaluates the link:tensor/tensor_expression.html[tensor expression] +`expr` and copyies all elements of the result. + +|`tensor& operator=(tensor other)` |Copies or moves elements of `other`. + +|`tensor& operator=(const_reference v)` |Initialiates all elements of a +tensor with `v`. +|=== + +===== iii. [#tensor_13]#Capacity# + +[cols=",",] +|=== +|Member function |Description + +|`bool empty() const` |Returns true if a tensor has zero elements. + +|`size_type size() const` |Returns the number of elements of the tensor. + +|`size_type rank() const` |Returns the number of dimensions of the +tensor. + +|`size_type order() const` |Returns the number of dimensions of the +tensor. + +|`strides_type const& strides() const` |Returns a constant reference to +the link:tensor/strides.html[strides] of the tensor. + +|`extents_type const& extents() const` |Returns a constant reference to +the link:tensor/extents.html[extents] of the tensor. +|=== + +===== iv. [#tensor_14]#Element access# + +[cols=",",] +|=== +|Member function |Description + +|`pointer data()` |Returns a `pointer` the first element of the tensor. + +|`const_pointer data() const` |Returns a `const_pointer` the first +element of the tensor. + +|`reference operator[](size_type j)` |Returns a `reference` to the +`j`-th element of the storage array of the tensor. Corresponds to the +function call `tensor::data()+j` + +|`const_reference operator[](size_type j) const` |Returns a +`const_reference` to the `j`-th element of the storage array of the +tensor. Corresponds to the function call `tensor::data()+j`. + +|`template reference at(size_type i, size_types ... is)` +|Returns a `reference` to the `(i,is...)`-th element of the tensor where +` (i,is...)` denotes a multi-index with `tensor::order()` elements. If +`sizeof...(is)==0`, `tensor::operator[i]` is called. + +|`template const_reference at(size_type i, size_types ... is)` +|Returns a `const_reference` to the `(i,is...)`-th element of the tensor +where ` (i,is...)` denotes a multi-index with `tensor::order()` +elements. If `sizeof...(is)==0`, `tensor::operator[i]` is called. +|=== + +===== v. [#tensor_15]#Proxy Generation# + +[cols=",",] +|=== +|Member function |Description + +|`template tensor_index operator()(indices::Index p, index_types ... ps)` +|Returns a link:tensor/tensor_index.html[tensor index] instance with +index objects `(p,ps...)` for a tensor contraction where +`sizeof...(ps)+1` must be equal to `tensor::order()`. +|=== + +===== vi. [#tensor_16]#Iterators# + +[cols=",",] +|=== +|Member function |Description + +|`const_iterator begin() const` |Returns a const_iterator pointing to +the first element of the tensor. + +|`const_iterator cbegin() const` |Returns a const_iterator pointing to +the first element of the tensor. + +|`iterator begin()` |Returns an iterator pointing to the first element +of the tensor. + +|`const_iterator end() const` |Returns a const_iterator pointing to the +position after the last element of the tensor. + +|`const_iterator cend() const` |Returns a const_iterator pointing to the +position after the last element of the tensor. + +|`iterator begin()` |Returns an iterator pointing to the position after +the last element of the tensor. +|=== + +===== vii. [#tensor_17]#Modifiers# + +[cols=",",] +|=== +|Member function |Description + +|`void reshape(extents_type const& e, value_type v = value_type{})` +|Reshapes the tensor according to the extents `e`. If `e.product()` is +greater than `tensor::size()`, the tensor is resized with `v`. +|=== + +===== viii. [#tensor_18]#Notes# + +[#tensor_1]#[1]# Supported parameters for the storage organization are +`first_order` and `last_order`. + +[#tensor_2]#[2]# Common parameters for the storage array are +`std::array` and `std::vector`. + +''''' + +Copyright (©) 2018 Cem Bassoy + +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 ). \ No newline at end of file diff --git a/doc/ublas/tensor/extents.adoc b/doc/ublas/tensor/extents.adoc new file mode 100644 index 000000000..618edb554 --- /dev/null +++ b/doc/ublas/tensor/extents.adoc @@ -0,0 +1,136 @@ +== Extents + +[[toc]] + +=== [#extents]#basic_extents# + +==== Description + +The template class `basic_extents` specifies dimension extents of a +link:../tensor.html#tensor[tensor] instance. + +==== Example + +[source, cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + shape s{4,3,2}; + for (auto i = 0u; i < s.size(); ++i) { + std::cout << s.at(i) << std::endl; + } +} +.... + +==== Definition + +Defined in the header tensor/extents.hpp. + +==== Public base classes + +None. + +==== Specialization + +`using shape = basic_extents` + +==== Template parameters + +[cols=",",] +|=== +|Parameter |Description +|`size_type` |Unsigned integer type. +|=== + +==== Member types + +[cols=",",] +|=== +|Member type |Description + +|`value_type` |Type `size_type` of the extents. + +|`size_type` |Unsigned integer such as `std::size_t`. + +|`reference` |Reference type which is `value_type&`. + +|`const_reference` |Constant reference type which is +`const value_type&`. + +|`pointer` |Pointer type which is `value_type*`. + +|`const_pointer` |Constant reference type which is `const value_type*`. +|=== + +==== Member Functions +[cols=",",] +|=== +|Member Function |Description + +|`basic_extents ()` |Constructs an empty instance of `basic_extents`. + +|`basic_extents (std::vector const& vector)` |Constructs an instance copying the content of `vector`. + +|`basic_extents (std::vector && vector)` |Constructs an instance moving the content of `vector`. + +|`basic_extents (std::initializer_list list)` |Constructs an instance from `list`. + +|`basic_extents (const_iterator first, const_iterator last)` |Constructs an instance from the range specified by `[first`,`last)`. + +|`basic_extents (basic_extents const& other)` |Constructs an instance from `other` copying its elements. + +|`basic_extents (basic_extents && other)` |Constructs an instance from `other` by moving its elements. + +|`basic_extents& operator= (basic_extents other)` |Assigns the elements of `other` to this instance. + +|`bool is_scalar() const` |Returns true if the elements are `(1,1,[1,...,1])`. + +|`bool is_vector() const` |Returns true if the elements are `(n,1,[1,...,1])` or `(1,n,[1,...,1])` where `n>1`. + +|`bool is_matrix() const` |Returns true if the elements are `(m,n,[1,...,1])` where `m>1` and +`n>1`. + +|`bool is_tensor() const` |Returns true if it is not a scalar, vector or matrix. + +|`const_pointer data() const` |Returns a `const_pointer` to the first element. + +|`pointer data()` |Returns a `pointer` to the first element. + +|`reference operator[](size_type i)` |Returns a `reference` to the `i`-th element. + +|`const_reference operator[](size_type i) const` |Returns a `const_reference` to the `i`-th element. + +|`reference at(size_type i)` |Returns a `reference` to the `i`-th element. + +|`const_reference at(size_type i) const` |Returns a `const_reference` to the `i`-th element. + +|`bool empty()` |Returns true if the container has no elements. + +|`size_type size() const` |Returns the number of elements. + +|`bool valid() const` |Returns true if size()>1 and all elements are greater than one. + +|`size_type product() const` |Returns the multiplication of all entries. + +|`basic_extents squeeze() const` |Returns a new instance where entries equal to one are eliminated. + +|`bool operator==(basic_extents const& b) const` |Returns true if all elements are equal. + +|`bool operator!=(basic_extents const& b) const` |Returns true if some elements are not equal. + +|`const_iterator begin() const` |Returns an `const_iterator pointing to the first element.` + +|`const_iterator end() const` |Returns a `const_iterator` pointing to an element passed the last element. + +|`std::vector base() const` |Returns a const reference to the private member sequence container holding all elements. + +|=== +''''' + +Copyright (©) 2018 Cem Bassoy + +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 ). diff --git a/doc/ublas/tensor/strides.adoc b/doc/ublas/tensor/strides.adoc new file mode 100644 index 000000000..1386a46db --- /dev/null +++ b/doc/ublas/tensor/strides.adoc @@ -0,0 +1,155 @@ +== Strides + +[[toc]] + +=== [#extents]#basic_strides# + +==== Description + +The template class `basic_strides` contains weights for a given storage +format in order to map multi-indices to scalar memory indices for +link:../tensor.html#tensor[tensor] instances. + +==== Example + +[source, cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + auto wf = strides(shape{4,3,2}); + for (auto i = 0u; i < wf.size(); ++i) + std::cout << wf.at(i) << std::endl; + // 1,4,12 + + auto wl = strides(shape{4,3,2}); + for (auto i = 0u; i < wl.size(); ++i) + std::cout << wl.at(i) << std::endl; + // 6,2,1 +} +.... + +==== Definition + +Defined in the header tensor/strides.hpp. + +==== Public base classes + +None. + +==== Specialization + +`templateusing strides = basic_strides` + +==== Template parameters + +[cols=",",] +|=== +|Parameter |Description +|`size_type` |Unsigned integer type. +|=== + +==== Member types + +[cols=",",] +|=== +|Member type |Description + +|`value_type` |Type `size_type` of the strides. + +|`size_type` |Unsigned integer such as `std::size_t`. + +|`reference` |Reference type which is `value_type&`. + +|`const_reference` |Constant reference type which is +`const value_type&`. + +|`pointer` |Pointer type which is `value_type*`. + +|`const_pointer` |Constant pointer type which is `const value_type*`. + +|`layout_type` |Layout type which can be either +`boost::numeric::ublas::first_order` or +`boost::numeric::ublas::last_order`. +|=== + +==== Member Functions + +[cols=",",] +|=== +|Member Function |Description + +|`basic_strides ()` |Constructs an empty instance of `basic_strides`. + +|`basic_strides (basic_extents const& be)` |Constructs an +instance based on the tensor extents specified by `be`. + +|`basic_strides (std::vector const& v)` |Constructs an +instance copying the content of `v`. + +|`basic_strides (std::vector && v)` |Constructs an instance +moving the content of `v`. + +|`basic_strides (basic_strides const& other)` |Constructs an instance +from `other` copying its elements. + +|`basic_strides (basic_strides && other)` |Constructs an instance from +`other` by moving its elements. + +|`basic_strides& operator= (basic_strides other)` |Assigns the elements +of `other` to this instance. + +|`const_pointer data() const` |Returns a `const_pointer` to the first +element. + +|`const_reference operator[](size_type i) const` |Returns a +`const_reference` to the `i`-th element. + +|`const_reference at(size_type i) const` |Returns a `const_reference` to +the `i`-th element. + +|`bool empty()` |Returns true if the container has no elements. + +|`size_type size() const` |Returns the number of elements. + +|`void clear()` |Erases all elements. + +|`bool operator==(basic_strides const& b) const` |Returns true if all +elements are equal. + +|`bool operator!=(basic_strides const& b) const` |Returns true if some +elements are not equal. + +|`const_iterator begin() const` |Returns an `const_iterator` pointing to +the first element. + +|`const_iterator end() const` |Returns a `const_iterator` pointing to an +element passed the last element. + +|`std::vector base() const` |Returns the private member +sequence container holding all elements. +|=== + +==== Non-Member Functions + +[cols=",",] +|=== +|Function |Description + +|`access(std::vector const& i, strides w)` +|Returns relative memory location depending on the multi-index vector +`i` and strides `w`. + +|`access(size_type sum, strides w, size_type i, size_types ... is)` +|Returns relative memory location depending on the indices `i`, +`is ...` and stride vector `w` (recursive function). +|=== + +''''' + +Copyright (©) 2018 Cem Bassoy + +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 ). diff --git a/doc/ublas/tensor/tensor_expression.adoc b/doc/ublas/tensor/tensor_expression.adoc new file mode 100644 index 000000000..7971dcc24 --- /dev/null +++ b/doc/ublas/tensor/tensor_expression.adoc @@ -0,0 +1,175 @@ +== Tensor Expressions + +[[toc]] + +=== [#tensor_expression]#Tensor Expression# + +==== Description + +The templated class `tensor_expression` is required to be a public +base of all classes. There is no Tensor Expression concept defined. + +==== Definition + +Defined in the header tensor/expression.hpp. + +==== Model of + +None. +++Not a Tensor Expression+++! + +==== Type requirements + +None. + +==== Public base classes + +`ublas_expression`. + +==== Template parameters + +[cols=",",] +|=== +|Parameter |Description +|`T` |The type of the tensor. +|`E` |The type of the tensor expression. +|=== + +==== Member types + +[cols=",",] +|=== +|Member type |Description +|`expression_type` |Type of the derived expression which is `E`. +|`type_category` |Tag for categorization which is `tensor_tag`. +|`tensor_type` |Reference type which is `T`. +|=== + +==== Public Member Functions + +[cols=",",] +|=== +|Member |Description + +|`const expression_type &operator()() const` |Returns a `const` +reference to the derived expression. +|=== + +=== [#entrywise_tensor_operations]#Entrywise Tensor Operations# + +==== [#binary_tensor_expression]#Binary Tensor Expression# + +===== Description + +The templated class `binary_tensor_expression` contains a +constant reference to a left and right expression that can be evaluated +by using the access operator. + +===== Definition + +Defined in the header tensor/expression.hpp. + +===== Model of + +Tensor Expression + +===== Type requirements + +None. + +===== Public base classes + +`tensor_expression>` + +===== Template parameters + +[cols=",",] +|=== +|Parameter |Description +|`T` |Type of the tensor. +|`EL` |Type of the left binary tensor expression. +|`ER` |Type of the right binary tensor expression. +|`OP` |Type of the binary operation. +|=== + +===== Member types + +[cols=",",] +|=== +|Member type |Description +|`expression_type_left` |Type of the left expression which is `EL`. +|`expression_type_right` |Type of the right expression which is `ER`. +|`tensor_type` |Reference type which is `T`. +|`binary_operation` |Type of the binary operation which is `OP`. +|=== + +===== Public Member Functions + +[cols=",",] +|=== +|Member |Description + +|`decltype(auto) operator()(std::size_t i) const` |Returns a `const` +reference to the i-th element of the expression. +|=== + +==== [#unary_tensor_expression]#Unary Tensor Expression# + +===== Description + +The templated class `unary_tensor_expression` contains a +constant reference to an expression that can be evaluated by using the +access operator. + +===== Definition + +Defined in the header tensor/expression.hpp. + +===== Model of + +Tensor Expression + +===== Type requirements + +None. + +===== Public base classes + +`tensor_expression>` + +===== Template parameters + +[cols=",",] +|=== +|Parameter |Description +|`T` |Type of the tensor. +|`E` |Type of the unary tensor expression. +|`OP` |Type of the unary operation. +|=== + +===== Member types + +[cols=",",] +|=== +|Member type |Description +|`expression_type` |Type of the expression which is `E`. +|`tensor_type` |Reference type which is `T`. +|`unary_operation` |Type of the unary operation which is `OP`. +|=== + +===== Public Member Functions + +[cols=",",] +|=== +|Member |Description + +|`decltype(auto) operator()(std::size_t i) const` |Returns a `const` +reference to the i-th element of the expression. +|=== + +''''' + +Copyright (©) 2018 Cem Bassoy + +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 ). diff --git a/doc/ublas/tensor/tensor_index.adoc b/doc/ublas/tensor/tensor_index.adoc new file mode 100644 index 000000000..b8e9198af --- /dev/null +++ b/doc/ublas/tensor/tensor_index.adoc @@ -0,0 +1,53 @@ +== Tensor Index + +[[toc]] + +=== [#tensor index]#tensor_index# + +==== Description + +The template class `tensor_index` decorates the +link:../tensor.html#tensor[tensor] template class with indices for +tensor contraction. + +==== Example + +[source, cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + shape s{4,3,2}; + for (auto i = 0u; i < s.size(); ++i) { + std::cout << s.at(i) << std::endl; + } +} +.... + +==== Definition + +Defined in the header tensor/tensor_einstein.hpp. + +==== Public base classes + +None. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description | +|`value_t` |The type of object stored in the tensor. | +|`format_t` |Storage organization of the tensor. | +|`storage_t` |The type of the storage array of the tensor. | +|`N` |Number of indices provided. | +|=== + +''''' + +Copyright (©) 2018 Cem Bassoy + +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 ). diff --git a/doc/ublas/triangular.adoc b/doc/ublas/triangular.adoc new file mode 100644 index 000000000..71259914e --- /dev/null +++ b/doc/ublas/triangular.adoc @@ -0,0 +1,416 @@ +== Triangular Matrix + +[[toc]] + +=== [#triangular_matrix]#Triangular Matrix# + +==== Description + +The templated class `triangular_matrix` 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 __t__~_i,j_~ += 0 , if _i > j_. If furthermore holds __t__~_i,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 __t__~_i,j_~= +0 , if _i < j_. If furthermore holds __t__~_i,i_~= 1 the matrix is +called unit lower triangular. The storage of triangular matrices is +packed. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + triangular_matrix 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 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 link:samples/ex_triangular.cpp[full triangular example] +for more details. + +==== Definition + +Defined in the header triangular.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the matrix. | + +|`F1` |Functor describing the type of the triangular matrix. +link:#triangular_matrix_1[[1]] |`lower` + +|`F2` |Functor describing the storage organization. +link:#triangular_matrix_2[[2]] |`row_major` + +|`A` |The type of the adapted array. link:#triangular_matrix_3[[3]] +|`unbounded_array` +|=== + +==== Model of + +link:container_concept.html#matrix[Matrix] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#matrix[Matrix] . + +==== Public base classes + +`matrix_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`triangular_matrix ()` |Allocates an uninitialized `triangular_matrix` +that holds zero rows of zero elements. + +|`triangular_matrix (size_type size1, size_type size2)` |Allocates an +uninitialized `triangular_matrix` that holds `size1` rows of `size2` +elements. + +|`triangular_matrix (const triangular_matrix &m)` |The copy constructor. + +|`template triangular_matrix (const matrix_expression &ae)` +|The extended copy constructor. + +|`void resize (size_type size1, size_type size2, bool preserve = true)` +|Reallocates a `triangular_matrix` to hold `size1` rows of `size2` +elements. The existing elements of the `triangular_matrix` are preseved +when specified. + +|`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. + +|`triangular_matrix &operator = (const triangular_matrix &m)` |The +assignment operator. + +|`triangular_matrix &assign_temporary (triangular_matrix &m)` |Assigns a +temporary. May change the triangular matrix `m`. + +|`template triangular_matrix &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template triangular_matrix &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the triangular matrix. Left and right +hand side of the assignment should be independent. + +|`template triangular_matrix &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +triangular matrix. + +|`template triangular_matrix &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the triangular matrix. Left and right hand +side of the assignment should be independent. + +|`template triangular_matrix &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the triangular matrix. + +|`template triangular_matrix &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the triangular matrix. Left and +right hand side of the assignment should be independent. + +|`template triangular_matrix &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the triangular matrix with a +scalar. + +|`template triangular_matrix &operator /= (const AT &at)` |A +computed assignment operator. Divides the triangular matrix through a +scalar. + +|`void swap (triangular_matrix &m)` |Swaps the contents of the +triangular 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 `triangular_matrix`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `triangular_matrix`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `triangular_matrix`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`triangular_matrix`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `triangular_matrix`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `triangular_matrix`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `triangular_matrix`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`triangular_matrix`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`triangular_matrix`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`triangular_matrix`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `triangular_matrix`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `triangular_matrix`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`triangular_matrix`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`triangular_matrix`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `triangular_matrix`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `triangular_matrix`. +|=== + +==== Notes + +[#triangular_matrix_1]#[1]# Supported parameters for the type of the +triangular matrix are `lower` , `unit_lower`, `upper` and `unit_upper` . + +[#triangular_matrix_2]#[2]# Supported parameters for the storage +organization are `row_major` and `column_major`. + +[#triangular_matrix_3]#[3]# Supported parameters for the adapted array +are `unbounded_array` , `bounded_array` and `std::vector` . + +=== [#triangular_adaptor]#Triangular Adaptor# + +==== Description + +The templated class `triangular_adaptor` is a triangular matrix +adaptor for other matrices. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + matrix m (3, 3); + triangular_adaptor, 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, 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 link:samples/ex_triangular.cpp[full triangular example] +for more details. + +==== Definition + +Defined in the header triangular.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`M` |The type of the adapted matrix. | + +|`F` |Functor describing the type of the triangular adaptor. +link:#triangular_adaptor_1[[1]] |`lower` +|=== + +==== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +==== Public base classes + +`matrix_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`triangular_adaptor (matrix_type &data)` |Constructs a +`triangular_adaptor` of a matrix. + +|`triangular_adaptor (const triangular_adaptor &m)` |The copy +constructor. + +|`template triangular_adaptor (const matrix_expression &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. + +|`triangular_adaptor &operator = (const triangular_adaptor &m)` |The +assignment operator. + +|`triangular_adaptor &assign_temporary (triangular_adaptor &m)` |Assigns +a temporary. May change the triangular adaptor `m`. + +|`template triangular_adaptor &operator = (const matrix_expression &ae)` +|The extended assignment operator. + +|`template triangular_adaptor &assign (const matrix_expression &ae)` +|Assigns a matrix expression to the triangular adaptor. Left and right +hand side of the assignment should be independent. + +|`template triangular_adaptor &operator += (const matrix_expression &ae)` +|A computed assignment operator. Adds the matrix expression to the +triangular adaptor. + +|`template triangular_adaptor &plus_assign (const matrix_expression &ae)` +|Adds a matrix expression to the triangular adaptor. Left and right hand +side of the assignment should be independent. + +|`template triangular_adaptor &operator -= (const matrix_expression &ae)` +|A computed assignment operator. Subtracts the matrix expression from +the triangular adaptor. + +|`template triangular_adaptor &minus_assign (const matrix_expression &ae)` +|Subtracts a matrix expression from the triangular adaptor. Left and +right hand side of the assignment should be independent. + +|`template triangular_adaptor &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the triangular adaptor with a +scalar. + +|`template triangular_adaptor &operator /= (const AT &at)` |A +computed assignment operator. Divides the triangular adaptor through a +scalar. + +|`void swap (triangular_adaptor &m)` |Swaps the contents of the +triangular adaptors. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the `triangular_adaptor`. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the `triangular_adaptor`. + +|`iterator1 begin1 ()` |Returns a `iterator1` pointing to the beginning +of the `triangular_adaptor`. + +|`iterator1 end1 ()` |Returns a `iterator1` pointing to the end of the +`triangular_adaptor`. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the `triangular_adaptor`. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the `triangular_adaptor`. + +|`iterator2 begin2 ()` |Returns a `iterator2` pointing to the beginning +of the `triangular_adaptor`. + +|`iterator2 end2 ()` |Returns a `iterator2` pointing to the end of the +`triangular_adaptor`. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +`triangular_adaptor`. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +`triangular_adaptor`. + +|`reverse_iterator1 rbegin1 ()` |Returns a `reverse_iterator1` pointing +to the beginning of the reversed `triangular_adaptor`. + +|`reverse_iterator1 rend1 ()` |Returns a `reverse_iterator1` pointing to +the end of the reversed `triangular_adaptor`. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +`triangular_adaptor`. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +`triangular_adaptor`. + +|`reverse_iterator2 rbegin2 ()` |Returns a `reverse_iterator2` pointing +to the beginning of the reversed `triangular_adaptor`. + +|`reverse_iterator2 rend2 ()` |Returns a `reverse_iterator2` pointing to +the end of the reversed `triangular_adaptor`. +|=== + +==== Notes + +[#triangular_adaptor_1]#[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 ). diff --git a/doc/ublas/types_overview.adoc b/doc/ublas/types_overview.adoc new file mode 100644 index 000000000..00c7220af --- /dev/null +++ b/doc/ublas/types_overview.adoc @@ -0,0 +1,352 @@ +== Overview of Tensor, Matrix- and Vector Types + +[[toc]] + +Contents: + + + link:#vectors[Vectors] + + + link:#vector_proxies[Vector Proxies] + + + link:#matrices[Matrices] + + + link:#matrix_proxies[Matrix Proxies] + + + link:#tensors[Tensors] + + + link:#storage_layout[Special Storage Layouts] + +=== Notation + +[cols=",",] +|=== +|`T` |is the data type. For general linear algebra operations this will +be a real type e.g. `double`, ... + +|`F` |is the orientation type, either `row_major` or `column_major` for +matrices and `first_order` or `last_order` for tensors + +|`A, IA, TA` |is an array storage type, e.g. +`std::vector, bounded_array, unbounded_array, ...` + +|`TRI` |is a triangular functor: +`lower, unit_lower, strict_lower, upper, unit_upper, strict_upper` + +|`M, N, K` |are unsigned integer sizes (`std::size_t`) + +|`IB` |is an index base (`std::size_t`) + +|`VEC` |is any vector type + +|`MAT` |is any matrix type + +|`TEN` |is any tensor type + +|`[...]` |denote optional arguments - for more details look at the +section "storage layout". +|=== + +=== [#vectors]#Vectors# + +[width="100%",cols="50%,50%",options="header",] +|=== +|Definition |Description +|`vector   v(size);` |a dense vector of values of type `T` of +variable size. A storage type `A` can be specified which defaults to +`unbounded_array`. Elements are constructed by `A`, which need not +initialise their value. + +|`bounded_vector   v;` |a dense vector of values of type `T` of +variable size but with maximum `N`. The default constructor creates `v` +with size `N`. Elements are constructed by the storage type +`bounded_array`, which need not initialise their value. + +|`c_vector   v(size);` |a dense vector of values of type `T` with +the given size. The data is stored as an ordinary C++ array `T data_[M]` + +|`zero_vector   v(size);` |the zero vector of type `T` with the given +size. + +|`unit_vector   v(size, index);` |the unit vector of type `T` with +the given size. The vector is zero other then a single specified +element. + +`index` should be less than `size`. + +|`mapped_vector   v(size);` |a sparse vector of values of type +`T` of variable size. The sparse storage type `S` can be +`std::map` or `map_array`. + +|`compressed_vector   v(size);` |a sparse vector of +values of type `T` of variable size. The non zero values are stored as +two seperate arrays - an index array and a value array. The index array +is always sorted and there is at most one entry for each index. + +|`coordinate_vector   v(size);` |a sparse vector of +values of type `T` of variable size. The non zero values are stored as +two seperate arrays - an index array and a value array. The arrays may +be out of order with multiple entries for each vector element. If there +are multiple values for the same index the sum of these values is the +real value. +|=== + +_Note:_ the default types are defined in `boost/numeric/ublas/fwd.hpp`. + +=== [#vector_proxies]#Vector Proxies# + +[cols=",",options="header",] +|=== +|Definition |Description +|`vector_range   vr(v, range);` |a vector referencing a continuous +subvector of elements of vector `v` containing all elements specified by +`range`. + +|`vector_slice   vs(v, slice);` |a vector referencing a non +continuous subvector of elements of vector `v` containing all elements +specified by `slice`. + +|`matrix_row   vr(m, index);` |a vector referencing the `index`-th +row of matrix `m` + +|`matrix_column   vc(m, index);` |a vector referencing the +`index`-th column of matrix `m` +|=== + +=== [#matrices]#Matrices# + +[cols=",",options="header",] +|=== +|Definition |Description +|`matrix   m(size1, size2);` |a dense matrix of values of +type `T` of variable size. A storage type `A` can be specified which +defaults to `unbounded_array`. The orientation functor `F` defaults to +`row_major`. Elements are constructed by `A`, which need not initialise +their value. + +|`bounded_matrix   m;` |a dense matrix of type `T` with +variable size with maximum `M`-by-`N`. The orientation functor `F` +defaults to `row_major`. The default constructor creates `m` with size +`M`-by-`N`. Elements are constructed by the storage type +`bounded_array`, which need not initialise their value. + +|`c_matrix   m(size1, size2);` |a dense matrix of values of +type `T` with the given size. The data is stored as an ordinary C++ +array `T data_[N][M]` + +|`vector_of_vector   m(size1, size2);` |a dense matrix of +values of type `T` with the given size. The data is stored as a vector +of vectors. The orientation `F` defaults to `row_major`. The storage +type `S` defaults to `unbounded_array >` + +|`zero_matrix   m(size1, size2);` |a zero matrix of type `T` with the +given size. + +|`identity_matrix   m(size1, size2);` |an identity matrix of type `T` +with the given size. The values are `v(i,j) = (i==j)?T(1):T()`. + +|`scalar_matrix   m(size1, size2, value);` |a matrix of type `T` with +the given size that has the value `value` everywhere. + +|`triangular_matrix   m(size);` |a triangular matrix of +values of type `T` of variable size. Only the nonzero elements are +stored in the given order `F`. ("triangular packed storage") The +triangular type `F` defaults to `lower`, the orientation type `F` +defaults to `row_major`. + +|`banded_matrix   m(size1, size2, n_lower, n_upper);` |a +banded matrix of values of type `T` of variable size with `n_lower` sub +diagonals and `n_upper` super diagonals. Only the nonzero elements are +stored in the given order `F`. ("packed storage") + +|`symmetric_matrix   m(size);` |a symmetric matrix of +values of type `T` of variable size. Only the given triangular matrix is +stored in the given order `F`. + +|`hermitian_matrix   m(size);` |a hermitian matrix of +values of type `T` of variable size. Only the given triangular matrix is +stored using the order `F`. + +|`mapped_matrix   m(size1, size2 [, non_zeros]);` |a sparse +matrix of values of type `T` of variable size. The sparse storage type +`S` can be either `std::map >` or +`map_array >`. + +|`sparse_vector_of_sparse_vector   m(size1, size2 [, non_zeros]);` +|a sparse matrix of values of type `T` of variable size. + +|`compressed_matrix   m(size1, size2 [, non_zeros]);` +|a sparse matrix of values of type `T` of variable size. The values are +stored in compressed row/column storage. + +|`coordinate_matrix   m(size1, size2 [, non_zeros]);` +|a sparse matrix of values of type `T` of variable size. The values are +stored in 3 parallel array as triples (i, j, value). More than one value +for each pair of indices is possible, the real value is the sum of all. + +|`generalized_vector_of_vector   m(size1, size2 [, non_zeros]);` +|a sparse matrix of values of type `T` of variable size. The values are +stored as a vector of sparse vectors, e.g. +`generalized_vector_of_vector > >` +|=== + +_Note:_ the default types are defined in `boost/numeric/ublas/fwd.hpp`. + +=== [#matrix_proxies]#Matrix Proxies# + +[cols=",",options="header",] +|=== +|Definition |Description +|`triangular_adaptor   ta(m);` |a triangular matrix +referencing a selection of elements of the matrix `m`. + +|`symmetric_adaptor   sa(m);` |a symmetric matrix referencing +a selection of elements of the matrix `m`. + +|`hermitian_adaptor   ha(m);` |a hermitian matrix referencing +a selection of elements of the matrix `m`. + +|`banded_adaptor   ba(m, n_lower, n_upper);` |a banded matrix +referencing a selection of elements of the matrix `m`. + +|`matrix_range   mr(m, range1, range2);` |a matrix referencing +a submatrix of elements in the matrix `m`. + +|`matrix_slice   ms(m, slice1, slice2);` |a matrix referencing +a non continues submatrix of elements in the matrix `m`. +|=== + +=== [#tensors]#Tensors# + +[cols=",",options="header",] +|=== +|Definition |Description +|`tensor   t(size1, size2, ... );` |a dense matrix of values +of type `T` of variable size. A storage type `A` can be specified which +defaults to `std::vector`. The orientation type `F` defaults to +`first_order`. Elements are constructed by `A`, which need not +initialise their value. +|=== + +=== [#storage_layout]#Special Storage Layouts# + +The library supports conventional dense, packed and basic sparse vector +and matrix storage layouts. The description of the most common +constructions of vectors and matrices comes next. + +[width="100%",cols="50%,50%",] +|=== +|Construction |Comment + +|`vector >   v (size)` |a dense vector, storage is +provided by a standard vector. + +The storage layout usually is BLAS compliant. + +|`vector >   v (size)` |a dense vector, storage +is provided by a heap-based array. + +The storage layout usually is BLAS compliant. + +|`vector >   v (size)` |a dense vector, storage +is provided by a stack-based array. + +The storage layout usually is BLAS compliant. + +|`mapped_vector >   v (size, non_zeros)` |a +sparse vector, storage is provided by a standard map. + +|`mapped_vector >   v (size, non_zeros)` +|a sparse vector, storage is provided by a map array. + +|`matrix >   m (size1, size2)` |a dense +matrix, orientation is row major, storage is provided by a standard +vector. + +|`matrix >   m (size1, size2)` |a +dense matrix, orientation is column major, storage is provided by a +standard vector. + +The storage layout usually is BLAS compliant. + +|`matrix >   m (size1, size2)` |a +dense matrix, orientation is row major, storage is provided by a +heap-based array. + +|`matrix >   m (size1, size2)` |a +dense matrix, orientation is column major, storage is provided by a +heap-based array. + +The storage layout usually is BLAS compliant. + +|`matrix >   m (size1, size2)` +|a dense matrix, orientation is row major, storage is provided by a +stack-based array. + +|`matrix >   m (size1, size2)` +|a dense matrix, orientation is column major, storage is provided by a +stack-based array. + +The storage layout usually is BLAS compliant. + +|`triangular_matrix   m (size)` |a packed +triangular matrix, orientation is row major. + +|`triangular_matrix   m (size)` |a packed +triangular matrix, orientation is column major. + +The storage layout usually is BLAS compliant. + +|`banded_matrix   m (size1, size2, lower, upper)` |a +packed banded matrix, orientation is row major. + +|`banded_matrix   m (size1, size2, lower, upper)` +|a packed banded matrix, orientation is column major. + +The storage layout usually is BLAS compliant. + +|`symmetric_matrix   m (size)` |a packed symmetric +matrix, orientation is row major. + +|`symmetric_matrix   m (size)` |a packed +symmetric matrix, orientation is column major. + +The storage layout usually is BLAS compliant. + +|`hermitian_matrix   m (size)` |a packed hermitian +matrix, orientation is row major. + +|`hermitian_matrix   m (size)` |a packed +hermitian matrix, orientation is column major. + +The storage layout usually is BLAS compliant. + +|`mapped_matrix >   m (size1, size2, non_zeros)` +|a sparse matrix, orientation is row major, storage is provided by a +standard map. + +|`mapped_matrix >   m (size1, size2, non_zeros)` +|a sparse matrix, orientation is column major, storage is provided by a +standard map. + +|`mapped_matrix >   m (size1, size2, non_zeros)` +|a sparse matrix, orientation is row major, storage is provided by a map +array. + +|`mapped_matrix >   m (size1, size2, non_zeros)` +|a sparse matrix, orientation is column major, storage is provided by a +map array. + +|`compressed_matrix   m (size1, size2, non_zeros)` |a +compressed matrix, orientation is row major. + +The storage layout usually is BLAS compliant. + +|`compressed_matrix   m (size1, size2, non_zeros)` |a +compressed matrix, orientation is column major. + +The storage layout usually is BLAS compliant. + +|`coordinate_matrix   m (size1, size2, non_zeros)` |a +coordinate matrix, orientation is row major. + +The storage layout usually is BLAS compliant. + +|`coordinate_matrix   m (size1, size2, non_zeros)` |a +coordinate matrix, orientation is column major. + +The storage layout usually is BLAS compliant. +|=== + +''''' + +Copyright (©) 2000-2004 Joerg Walter, Mathias Koch, Gunter Winkler, +Michael Stevens + +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 ). diff --git a/doc/ublas/unbounded_array.adoc b/doc/ublas/unbounded_array.adoc new file mode 100644 index 000000000..a64b2368e --- /dev/null +++ b/doc/ublas/unbounded_array.adoc @@ -0,0 +1,147 @@ +== Unbounded Array Storage + +[[toc]] + +=== [#unbounded_array]#Unbounded Array# + +==== Description + +The templated class `unbounded_array` implements a unbounded +storage array using an allocator. The unbounded array is similar to a +`std::vector` in that in can grow in size beyond any fixed bound. +However `unbounded_array` is aimed at optimal performance. Therefore +`unbounded_array` does not model a `Sequence` like `std::vector` does. + +When resized `unbounded_array` will reallocate it's storage even if the +new size requirement is smaller. It is therefore inefficient to resize a +`unbounded_array` + +==== Example + +[source, cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + unbounded_array a (3); + for (unsigned i = 0; i < a.size (); ++ i) { + a [i] = i; + std::cout << a [i] << std::endl; + } +} +.... + +==== Definition + +Defined in the header storage.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`T` |The type of object stored in the array. | +|`ALLOC` |An STL Allocator |std::allocator +|=== + +==== Model of + +link:storage_concept.html[Storage] + +==== Type requirements + +None, except for those imposed by the requirements of Storage. + +==== Public base classes + +None. + +==== Members + +* The description does not describe what the member actually does, this +can be looked up in the corresponding concept documentation, but instead +contains a remark on the implementation of the member inside this model +of the concept. +* Typography: +** Members that are not part of the implemented concepts are in blue. + +[cols=,,,] +|=== +|Member |Where defined |Description + +|`value_type` |https://www.boost.org/sgi/stl/Container.html[Container] | + +|`pointer` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `value_type*` + +|`const_pointer` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `const value_type*` + +|`reference` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `value_type&` + +|`const_reference` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `const value_type&` + +|`size_type` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `Alloc::size_type` + +|`difference_type` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `Alloc::difference_type` + +|`iterator` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `pointer` + +|`const_iterator` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `const_pointer` + +|`revere_iterator` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `std::reverse_iterator` + +|`const_revere_iterator` |https://www.boost.org/sgi/stl/Container.html[Container] |Defined as `std::reverse_iterator` + +|[blue]#allocator_type# | |Defined as ALLOC + +|`explicit unbounded_array (ALLOC &a = ALLOC())` |link:storage_concept.html[Storage] |Creates an `unbounded_array` that holds zero elements, using a specified allocator. + +|`explicit unbounded_array (size_type size, ALLOC &a = ALLOC())` |link:storage_concept.html[Storage] |Creates a uninitialized `unbounded_array` that holds `size` elements, using a specified allocator. All the elements are default constructed. + +|`unbounded_array (size_type size, const T& init, ALLOC& a = ALLOC())` |link:storage_concept.html[Storage] |Creates an initialized `unbounded_array` that holds `size` elements,using a specified allocator. All the elements are constructed from the `init` value. + +|`unbounded_array (const unbounded_array &a)` |https://www.boost.org/sgi/stl/Container.html[Container] |The copy constructor. + +|`~unbounded_array ()` |https://www.boost.org/sgi/stl/Container.html[Container] |Deallocates the `unbounded_array` itself. + +|`void resize (size_type n)` |link:storage_concept.html[Storage] |Reallocates an `unbounded_array` to hold `n` elements. Values are uninitialised. + +|`void resize(size_type n, const T& t)` |link:storage_concept.html[Storage] |Reallocates an `unbounded_array` to hold `n` elements. Values are copies of `t` + +|`size_type size () const` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns the size of the `unbounded_array`. + +|`const_reference operator [] (size_type i) const` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a `const` reference of the `i` -th element. + +|`reference operator [] (size_type i)` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a reference of the `i`-th element. + +|`unbounded_array &operator = (const unbounded_array &a)` |https://www.boost.org/sgi/stl/Container.html[Container] |The assignment operator. + +|[blue]#`unbounded_array &assign_temporary (unbounded_array &a)`# | |Assigns a temporary. May change the array `a`. + +|`void swap (unbounded_array &a)` |https://www.boost.org/sgi/stl/Container.html[Container] |Swaps the contents of the arrays. + +|`const_iterator begin () const` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a `const_iterator` pointing to the beginning of the `unbounded_array`. + +|`const_iterator end () const` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a `const_iterator` pointing to the end of the `unbounded_array`. + +|`iterator begin ()` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a `iterator` pointing to the beginning of the `unbounded_array`. + +|`iterator end ()` |https://www.boost.org/sgi/stl/Container.html[Container] |Returns a `iterator` pointing to the end of the `unbounded_array`. + +|`const_reverse_iterator rbegin () const` |https://www.boost.org/sgi/stl/ReversibleContainer.html[ReversibleContainer] |Returns a `const_reverse_iterator` pointing to the beginning of the reversed `unbounded_array`. + +|`const_reverse_iterator rend () const` |https://www.boost.org/sgi/stl/ReversibleContainer.html[ReversibleContainer] |Returns a `const_reverse_iterator` pointing to the end of the reversed `unbounded_array`. + +|`reverse_iterator rbegin ()` |https://www.boost.org/sgi/stl/ReversibleContainer.html[ReversibleContainer] |Returns a `reverse_iterator` pointing to the beginning of the reversed `unbounded_array`. + +|`reverse_iterator rend ()` |https://www.boost.org/sgi/stl/ReversibleContainer.html[ReversibleContainer] |Returns a `reverse_iterator` pointing to the end of the reversed `unbounded_array`. + +|=== + +''''' + +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 ). diff --git a/doc/ublas/vector.adoc b/doc/ublas/vector.adoc new file mode 100644 index 000000000..d395d44fc --- /dev/null +++ b/doc/ublas/vector.adoc @@ -0,0 +1,555 @@ +== Vector + +[[toc]] + +=== [#vector]#Vector# + +==== Description + +The templated class `vector` is the base container adaptor for +dense vectors. For a _n_-dimensional vector and _0 < = i < n_ every +element __v__~_i_~ is mapped to the __i-__th element of the container. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + vector v (3); + for (unsigned i = 0; i < v.size (); ++ i) + v (i) = i; + std::cout << v << std::endl; +} +.... + +==== Definition + +Defined in the header vector.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the vector. | + +|`A` |The type of the link:storage_concept.html[Storage] array. +link:#vector_1[[1]] |`unbounded_array` +|=== + +==== Model of + +link:container_concept.html#vector[Vector], +http://www.boost.org/sgi/stl/RandomAccessContainer.html[RandomAccessContainer] + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#vector[Vector] and +http://www.boost.org/sgi/stl/RandomAccessContainer.html[RandomAccessContainer]. + +==== Public base classes + +`vector_container >` + +==== Members + +[cols=",,",] +|=== +|Member |Where defined |Description + +|`value_type` +|link:expression_concept.html#vector_expression[VectorExpression] | + +|`reference` +|link:expression_concept.html#vector_expression[VectorExpression] | + +|`const_reference` +|link:expression_concept.html#vector_expression[VectorExpression] | + +|`size_type` +|link:expression_concept.html#vector_expression[VectorExpression] | + +|`difference_type` +|link:expression_concept.html#vector_expression[VectorExpression] | + +|`const_iterator` +|link:expression_concept.html#vector_expression[VectorExpression] | + +|`iterator` +|link:expression_concept.html#vector_expression[VectorExpression] | + +|`const_reverse_iterator` +|link:expression_concept.html#vector_expression[VectorExpression] | + +|`reverse_iterator` +|link:expression_concept.html#vector_expression[VectorExpression] | + +|`array_type` |link:container_concept.html#vector[Vector] | + +|`vector ()` +|link:expression_concept.html#vector_expression[VectorExpression] +|Allocates an uninitialized `vector` that holds zero elements. + +|`vector (size_type size)` |link:container_concept.html#vector[Vector] +|Allocates an uninitialized `vector` that holds `size` elements. + +|`vector (const vector &v)` | |The copy constructor. + +|`template vector (const vector_expression &ae)` | |The +extended copy constructor. + +|`void resize (size_type size, bool preserve = true)` +|link:container_concept.html#vector[Vector] |Reallocates a `vector` to +hold `size` elements. The existing elements of the `vector` are preseved +when specified. + +|`size_type size () const` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns the size of the `vector`. + +|`size_type max_size () const` +|https://www.boost.org/sgi/stl/RandomAccessContainer.html[RandomAccessContainer] +|Returns the upper bound on the size of the `vector`. + +|`bool empty () const` +|http://www.boost.org/sgi/stl/RandomAccessContainer.html[RandomAccessContainer] +|Equivilent to `size () == 0`. + +|`const array_type& data () const` +|link:container_concept.html#vector[Vector] | + +|`array_type& data ()` |link:container_concept.html#vector[Vector] | + +|`const_reference operator () (size_type i) const` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns a `const` reference of the `i` -th element. + +|`reference operator () (size_type i)` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns a reference of the `i`-th element. + +|`const_reference operator [] (size_type i) const` +|link:container_concept.html#vector[Vector] |Returns a `const` reference +of the `i` -th element. + +|`reference operator [] (size_type i)` +|link:container_concept.html#vector[Vector] |Returns a reference of the +`i`-th element. + +|`vector &operator = (const vector &v)` +|link:expression_concept.html#vector_expression[VectorExpression] |The +assignment operator. + +|`vector &assign_temporary (vector &v)` +|link:expression_concept.html#vector_expression[VectorExpression] +|Assigns a temporary. May change the vector `v`. + +|`template vector &operator = (const vector_expression &ae)` +|link:expression_concept.html#vector_expression[VectorExpression] |The +extended assignment operator. + +|`template vector &assign (const vector_expression &ae)` +|link:expression_concept.html#vector_expression[VectorExpression] +|Assigns a vector expression to the vector. Left and right hand side of +the assignment should be independent. + +|`template vector &operator += (const vector_expression &ae)` +|link:expression_concept.html#vector_expression[VectorExpression] |A +computed assignment operator. Adds the vector expression to the vector. + +|`template vector &plus_assign (const vector_expression &ae)` +|link:expression_concept.html#vector_expression[VectorExpression] |Adds +a vector expression to the vector. Left and right hand side of the +assignment should be independent. + +|`template vector &operator -= (const vector_expression &ae)` +|link:expression_concept.html#vector_expression[VectorExpression] |A +computed assignment operator. Subtracts the vector expression from the +vector. + +|`template vector &minus_assign (const vector_expression &ae)` +|link:expression_concept.html#vector_expression[VectorExpression] +|Subtracts a vector expression from the vector. Left and right hand side +of the assignment should be independent. + +|`template vector &operator *= (const AT &at)` +|link:expression_concept.html#vector_expression[VectorExpression] |A +computed assignment operator. Multiplies the vector with a scalar. + +|`template vector &operator /= (const AT &at)` +|link:expression_concept.html#vector_expression[VectorExpression] |A +computed assignment operator. Divides the vector through a scalar. + +|`void swap (vector &v)` +|link:expression_concept.html#vector_expression[VectorExpression] |Swaps +the contents of the vectors. + +|`void insert_element (size_type i, const_reference t)` +|link:container_concept.html#vector[Vector] |Inserts the value `t` at +the `i`-th element. + +|`void erase_element (size_type i)` +|link:container_concept.html#vector[Vector] |Erases the value at the +`i`-th element. + +|`void clear ()` |link:container_concept.html#vector[Vector] |Clears the +vector. + +|`const_iterator begin () const` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns a `const_iterator` pointing to the beginning of the `vector`. + +|`const_iterator end () const` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns a `const_iterator` pointing to the end of the `vector`. + +|`iterator begin ()` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns a `iterator` pointing to the beginning of the `vector`. + +|`iterator end ()` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns a `iterator` pointing to the end of the `vector`. + +|`const_reverse_iterator rbegin () const` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns a `const_reverse_iterator` pointing to the beginning of the +reversed `vector`. + +|`const_reverse_iterator rend () const` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns a `const_reverse_iterator` pointing to the end of the reversed +`vector`. + +|`reverse_iterator rbegin ()` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns a `reverse_iterator` pointing to the beginning of the reversed +`vector`. + +|`reverse_iterator rend ()` +|link:expression_concept.html#vector_expression[VectorExpression] +|Returns a `reverse_iterator` pointing to the end of the reversed +`vector`. +|=== + +==== Notes + +[#vector_1]#[1]# Common parameters for the Storage array are +`unbounded_array` , `bounded_array` and `std::vector` . + +=== [#unit_vector]#Unit Vector# + +==== Description + +The templated class `unit_vector` represents canonical unit +vectors. For the _k_-th _n_-dimensional canonical unit vector and _0 <= +i < n_ holds __u__^_k_^~_i_~ _= 0_, if _i <> k_, and __u__^_k_^~_i_~ _= +1_. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + for (int i = 0; i < 3; ++ i) { + unit_vector v (3, i); + std::cout << v << std::endl; + } +} +.... + +==== Definition + +Defined in the header vector.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the vector. |`int` + +|`ALLOC` |An STL Allocator for size_type and difference_type. +|std::allocator +|=== + +==== Model of + +link:container_concept.html#vector[Vector] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#vector[Vector] . + +==== Public base classes + +`vector_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`unit_vector ()` |Constructs an `unit_vector` that holds zero elements. + +|`unit_vector (size_type size, size_type index)` |Constructs the +`index`-th `unit_vector` that holds `size` elements. + +|`unit_vector (const unit_vector &v)` |The copy constructor. + +|`void resize (size_type size, bool preserve = true)` |Resizes a +`unit_vector` to hold `size` elements. Therefore the existing elements +of the `unit_vector` are always preseved. + +|`size_type size () const` |Returns the size of the `unit_vector`. + +|`size_type index () const` |Returns the index of the `unit_vector`. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`const_reference operator [] (size_type i) const` |Returns the value of +the `i`-th element. + +|`unit_vector &operator = (const unit_vector &v)` |The assignment +operator. + +|`unit_vector &assign_temporary (unit_vector &v)` |Assigns a temporary. +May change the unit vector `v` . + +|`void swap (unit_vector &v)` |Swaps the contents of the unit vectors. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `unit_vector`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `unit_vector`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`unit_vector`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`unit_vector`. +|=== + +=== [#zero_vector]#Zero Vector# + +==== Description + +The templated class `zero_vector` represents zero vectors. For +a _n_-dimensional zero vector and _0 <= i < n_ holds __z__~_i_~ _= 0_. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + zero_vector v (3); + std::cout << v << std::endl; +} +.... + +==== Definition + +Defined in the header vector.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the vector. |`int` + +|`ALLOC` |An STL Allocator for size_type and difference_type. +|std::allocator +|=== + +==== Model of + +link:container_concept.html#vector[Vector] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#vector[Vector] . + +==== Public base classes + +`vector_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`zero_vector ()` |Constructs a `zero_vector` that holds zero elements. + +|`zero_vector (size_type size)` |Constructs a `zero_vector` that holds +`size` elements. + +|`zero_vector (const zero_vector &v)` |The copy constructor. + +|`void resize (size_type size, bool preserve = true)` |Resizes a +`zero_vector` to hold `size` elements. Therefore the existing elements +of the `zero_vector` are always preseved. + +|`size_type size () const` |Returns the size of the `zero_vector`. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`const_reference operator [] (size_type i) const` |Returns the value of +the `i`-th element. + +|`zero_vector &operator = (const zero_vector &v)` |The assignment +operator. + +|`zero_vector &assign_temporary (zero_vector &v)` |Assigns a temporary. +May change the zero vector `v` . + +|`void swap (zero_vector &v)` |Swaps the contents of the zero vectors. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `zero_vector`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `zero_vector`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`zero_vector`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`zero_vector`. +|=== + +=== [#scalar_vector]#Scalar Vector# + +==== Description + +The templated class `scalar_vector` represents scalar vectors. +For a _n_-dimensional scalar vector and _0 <= i < n_ holds __z__~_i_~ _= +s_. + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + scalar_vector v (3); + std::cout << v << std::endl; +} +.... + +==== Definition + +Defined in the header vector.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the vector. |`int` + +|`ALLOC` |An STL Allocator for size_type and difference_type. +|std::allocator +|=== + +==== Model of + +link:container_concept.html#vector[Vector] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#vector[Vector] . + +==== Public base classes + +`vector_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`scalar_vector ()` |Constructs a `scalar_vector` that holds zero +elements. + +|`scalar_vector (size_type size, const value_type &value)` |Constructs a +`scalar_vector` that holds `size` elements each of the specified value. + +|`scalar_vector (const scalar_vector &v)` |The copy constructor. + +|`void resize (size_type size, bool preserve = true)` |Resizes a +`scalar_vector` to hold `size` elements. Therefore the existing elements +of the `scalar_vector` are always preseved. + +|`size_type size () const` |Returns the size of the `scalar_vector`. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`const_reference operator [] (size_type i) const` |Returns the value of +the `i`-th element. + +|`scalar_vector &operator = (const scalar_vector &v)` |The assignment +operator. + +|`scalar_vector &assign_temporary (scalar_vector &v)` |Assigns a +temporary. May change the scalar vector `v` . + +|`void swap (scalar_vector &v)` |Swaps the contents of the scalar +vectors. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `scalar_vector`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `scalar_vector`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`scalar_vector`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`scalar_vector`. +|=== + +''''' + +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 ). diff --git a/doc/ublas/vector_expression.adoc b/doc/ublas/vector_expression.adoc new file mode 100644 index 000000000..6ae7bbf3c --- /dev/null +++ b/doc/ublas/vector_expression.adoc @@ -0,0 +1,913 @@ +== Vector Expressions + +[[toc]] + +=== [#vector_expression]#Vector Expression# + +==== Description + +The templated class `vector_expression` is required to be a public +base of all classes which model the Vector Expression concept. + +==== Definition + +Defined in the header expression_types.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E` |The type of the vector expression. |  +|=== + +==== Model of + +None. +++Not a Vector Expression+++! + +==== Type requirements + +None. + +==== Public base classes + +None. + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`const expression_type &operator () () const` |Returns a `const` +reference of the expression. + +|`expression_type &operator () ()` |Returns a reference of the +expression. +|=== + +==== Notes + +The `range`, `slice` and `project` functions have been removed. Use the +free functions defined in link:vector_proxy.html[vector proxy] instead. + +=== [#vector_container]#Vector Container# + +==== Description + +The templated class `vector_container` is required to be a public +base of all classes which model the Vector concept. This includes the +class `vector` itself. + +==== Definition + +Defined in the header expression_types.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`C` |The type of the vector container. |  +|=== + +==== Model of + +None. +++Not a Vector Expression OR Vector+++! + +==== Type requirements + +None. + +==== Public base classes + +`vector_expression` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`const container_type &operator () () const` |Returns a `const` +reference of the container. + +|`container_type &operator () ()` |Returns a reference of the container. +|=== + +=== [#vector_references]#Vector References# + +==== Reference + +===== Description + +The templated class `vector_reference` contains a reference to a +vector expression. + +===== Definition + +Defined in the header vector_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E` |The type of the vector expression. |  +|=== + +===== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Public base classes + +`vector_expression >` + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`vector_reference (expression_type &e)` |Constructs a reference of the +expression. + +|`void resize (size_type size)` |Resizes the expression to hold at most +`size` elements. + +|`size_type size () const` |Returns the size of the expression. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator () (size_type i)` |Returns a reference of the +`i`-th element. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the expression. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the expression. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the expression. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +expression. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed expression. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed expression. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed expression. +|=== + +=== [#vector_operations]#Vector Operations# + +==== Unary Operation Description + +===== Description + +The templated class `vector_unary` describes a unary vector +operation. + +===== Definition + +Defined in the header vector_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E` |The type of the vector expression. |  +|`F` |The type of the operation. |  +|=== + +===== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Public base classes + +`vector_expression >` + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`vector_unary (const expression_type &e)` |Constructs a description of +the expression. + +|`size_type size () const` |Returns the size of the expression. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the expression. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the expression. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed expression. +|=== + +==== Unary Operations + +===== Prototypes + +[source,cpp] +.... +template + struct vector_unary_traits { + typedef vector_unary expression_type; + typedef expression_type result_type; + }; + + // (- v) [i] = - v [i] + template + typename vector_unary_traits >::result_type + operator - (const vector_expression &e); + + // (conj v) [i] = conj (v [i]) + template + typename vector_unary_traits >::result_type + conj (const vector_expression &e); + + // (real v) [i] = real (v [i]) + template + typename vector_unary_traits >::result_type + real (const vector_expression &e); + + // (imag v) [i] = imag (v [i]) + template + typename vector_unary_traits >::result_type + imag (const vector_expression &e); + + // (trans v) [i] = v [i] + template + typename vector_unary_traits >::result_type + trans (const vector_expression &e); + + // (herm v) [i] = conj (v [i]) + template + typename vector_unary_traits >::result_type + herm (const vector_expression &e); +.... + +===== Description + +`operator -` computes the additive inverse of a vector expression. +`conj` computes the complex conjugate of a vector expression. `real` and +`imag` compute the real and imaginary parts of a vector expression. +`trans` computes the transpose of a vector expression. `herm` computes +the hermitian, i.e. the complex conjugate of the transpose of a vector +expression. + +===== Definition + +Defined in the header vector_expression.hpp. + +===== Type requirements + +* `E` is a model of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Preconditions + +None. + +===== Complexity + +Linear depending from the size of the vector expression. + +===== Examples + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + vector > v (3); + for (unsigned i = 0; i < v.size (); ++ i) + v (i) = std::complex (i, i); + + std::cout << - v << std::endl; + std::cout << conj (v) << std::endl; + std::cout << real (v) << std::endl; + std::cout << imag (v) << std::endl; + std::cout << trans (v) << std::endl; + std::cout << herm (v) << std::endl; +} +.... + +==== Binary Operation Description + +===== Description + +The templated class `vector_binary` describes a binary vector +operation. + +===== Definition + +Defined in the header vector_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E1` |The type of the first vector expression. | +|`E2` |The type of the second vector expression. | +|`F` |The type of the operation. | +|=== + +===== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Public base classes + +`vector_expression >` + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`vector_binary (const expression1_type &e1, const expression2_type &e2)` +|Constructs a description of the expression. + +|`size_type size () const` |Returns the size of the expression. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the expression. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the expression. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed expression. +|=== + +==== Binary Operations + +===== Prototypes + +[source,cpp] +.... +template + struct vector_binary_traits { + typedef vector_binary expression_type; + typedef expression_type result_type; + }; + + // (v1 + v2) [i] = v1 [i] + v2 [i] + template + typename vector_binary_traits >::result_type + operator + (const vector_expression &e1, + const vector_expression &e2); + + // (v1 - v2) [i] = v1 [i] - v2 [i] + template + typename vector_binary_traits >::result_type + operator - (const vector_expression &e1, + const vector_expression &e2); +.... + +===== Description + +`operator +` computes the sum of two vector expressions. `operator -` +computes the difference of two vector expressions. + +===== Definition + +Defined in the header vector_expression.hpp. + +===== Type requirements + +* `E1` is a model of +link:expression_concept.html#vector_expression[Vector Expression] . +* `E2` is a model of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Preconditions + +* `e1 ().size () == e2 ().size ()` + +===== Complexity + +Linear depending from the size of the vector expressions. + +===== Examples + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + vector v1 (3), v2 (3); + for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i) + v1 (i) = v2 (i) = i; + + std::cout << v1 + v2 << std::endl; + std::cout << v1 - v2 << std::endl; +} +.... + +==== Binary Outer Operation Description + +===== Description + +The templated class `vector_matrix_binary` describes a binary +outer vector operation. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E1` |The type of the first vector expression. | +|`E2` |The type of the second vector expression. | +|`F` |The type of the operation. | +|=== + +===== Model of + +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#matrix_expression[Matrix Expression] . + +===== Public base classes + +`matrix_expression >` + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`vector_matrix_binary (const expression1_type &e1, const expression2_type &e2)` +|Constructs a description of the expression. + +|`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 +the value of the `j`-th element in the `i`-th row. + +|`const_iterator1 begin1 () const` |Returns a `const_iterator1` pointing +to the beginning of the expression. + +|`const_iterator1 end1 () const` |Returns a `const_iterator1` pointing +to the end of the expression. + +|`const_iterator2 begin2 () const` |Returns a `const_iterator2` pointing +to the beginning of the expression. + +|`const_iterator2 end2 () const` |Returns a `const_iterator2` pointing +to the end of the expression. + +|`const_reverse_iterator1 rbegin1 () const` |Returns a +`const_reverse_iterator1` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator1 rend1 () const` |Returns a +`const_reverse_iterator1` pointing to the end of the reversed +expression. + +|`const_reverse_iterator2 rbegin2 () const` |Returns a +`const_reverse_iterator2` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator2 rend2 () const` |Returns a +`const_reverse_iterator2` pointing to the end of the reversed +expression. +|=== + +==== Binary Outer Operations + +===== Prototypes + +[source,cpp] +.... +template + struct vector_matrix_binary_traits { + typedef vector_matrix_binary expression_type; + typedef expression_type result_type; + }; + + // (outer_prod (v1, v2)) [i] [j] = v1 [i] * v2 [j] + template + typename vector_matrix_binary_traits >::result_type + outer_prod (const vector_expression &e1, + const vector_expression &e2); +.... + +===== Description + +`outer_prod` computes the outer product of two vector expressions. + +===== Definition + +Defined in the header matrix_expression.hpp. + +===== Type requirements + +* `E1` is a model of +link:expression_concept.html#vector_expression[Vector Expression] . +* `E2` is a model of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Preconditions + +None. + +===== Complexity + +Quadratic depending from the size of the vector expressions. + +===== Examples + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + vector v1 (3), v2 (3); + for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i) + v1 (i) = v2 (i) = i; + + std::cout << outer_prod (v1, v2) << std::endl; +} +.... + +==== Scalar Vector Operation Description + +===== Description + +The templated classes `vector_binary_scalar1` and +`vector_binary_scalar2` describe binary operations between a +scalar and a vector. + +===== Definition + +Defined in the header vector_expression.hpp. + +===== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`E1/E2` |The type of the scalar expression. | +|`E2/E1` |The type of the vector expression. | +|`F` |The type of the operation. | +|=== + +===== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Public base classes + +`vector_expression >` and +`vector_expression >` resp. + +===== Members + +[cols=",",] +|=== +|Member |Description + +|`vector_binary_scalar1 (const expression1_type &e1, const expression2_type &e2)` +|Constructs a description of the expression. + +|`vector_binary_scalar2 (const expression1_type &e1, const expression2_type &e2)` +|Constructs a description of the expression. + +|`size_type size () const` |Returns the size of the expression. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the expression. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the expression. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +expression. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed expression. +|=== + +==== Scalar Vector Operations + +===== Prototypes + +[source,cpp] +.... +template + struct vector_binary_scalar1_traits { + typedef vector_binary_scalar1, + typename E2::const_closure_type, F> expression_type; + typedef expression_type result_type; + }; + + // (t * v) [i] = t * v [i] + template + typename vector_binary_scalar1_traits >::result_type + operator * (const T1 &e1, + const vector_expression &e2); + + template + struct vector_binary_scalar2_traits { + typedef vector_binary_scalar2, F> expression_type; + typedef expression_type result_type; + }; + + // (v * t) [i] = v [i] * t + template + typename vector_binary_scalar2_traits >::result_type + operator * (const vector_expression &e1, + const T2 &e2); + + // (v / t) [i] = v [i] / t + template + typename vector_binary_scalar2_traits >::result_type + operator / (const vector_expression &e1, + const T2 &e2); +.... + +===== Description + +`operator *` computes the product of a scalar and a vector expression. +`operator /` multiplies the vector with the reciprocal of the scalar. + +===== Definition + +Defined in the header vector_expression.hpp. + +===== Type requirements + +* `T1/T2` is a model of +link:expression_concept.html#scalar_expression[Scalar Expression] . +* `E2/E1` is a model of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Preconditions + +None. + +===== Complexity + +Linear depending from the size of the vector expression. + +===== Examples + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + vector v (3); + for (unsigned i = 0; i < v.size (); ++ i) + v (i) = i; + + std::cout << 2.0 * v << std::endl; + std::cout << v * 2.0 << std::endl; +} +.... + +=== [#vector_reductions]#Vector Reductions# + +==== Unary Reductions + +===== Prototypes + +[source,cpp] +.... +template + struct vector_scalar_unary_traits { + typedef typename F::result_type result_type; + }; + + // sum v = sum (v [i]) + template + typename vector_scalar_unary_traits >::result_type + sum (const vector_expression &e); + + // norm_1 v = sum (abs (v [i])) + template + typename vector_scalar_unary_traits >::result_type + norm_1 (const vector_expression &e); + + // norm_2 v = sqrt (sum (v [i] * v [i])) + template + typename vector_scalar_unary_traits >::result_type + norm_2 (const vector_expression &e); + + // norm_2_square v = sum (v [i] * v [i]) + template + typename vector_scalar_unary_traits >::result_type + norm_2_square (const vector_expression &e); + + // norm_inf v = max (abs (v [i])) + template + typename vector_scalar_unary_traits >::result_type + norm_inf (const vector_expression &e); + + // index_norm_inf v = min (i: abs (v [i]) == max (abs (v [i]))) + template + typename vector_scalar_unary_traits >::result_type + index_norm_inf (const vector_expression &e); +.... + +===== Description + +`sum` computes the sum of the vector expression's elements. `norm_1`, +`norm_2` and `norm_inf` compute the corresponding __||.||__~_1_~, +__||.||__~_2_~ and __||.||__~_inf_~ vector norms. `index_norm_1` +computes the index of the vector expression's first element having +maximal absolute value. + +===== Definition + +Defined in the header vector_expression.hpp. + +===== Type requirements + +* `E` is a model of link:#vector_expression[Vector Expression] . + +===== Preconditions + +None. + +===== Complexity + +Linear depending from the size of the vector expression. + +===== Examples + +[source,cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + vector v (3); + for (unsigned i = 0; i < v.size (); ++ i) + v (i) = i; + + std::cout << sum (v) << std::endl; + std::cout << norm_1 (v) << std::endl; + std::cout << norm_2 (v) << std::endl; + std::cout << norm_inf (v) << std::endl; + std::cout << index_norm_inf (v) << std::endl; +} +.... + +==== Binary Reductions + +===== Prototypes + +[source,cpp] +.... +template + struct vector_scalar_binary_traits { + typedef typename F::result_type result_type; + }; + + // inner_prod (v1, v2) = sum (v1 [i] * v2 [i]) + template + typename vector_scalar_binary_traits::promote_type> >::result_type + inner_prod (const vector_expression &e1, + const vector_expression &e2); + + template + typename vector_scalar_binary_traits::promote_type>::precision_type> >::result_type + prec_inner_prod (const vector_expression &e1, + const vector_expression &e2); +.... + +===== Description + +`inner_prod` computes the inner product of the vector expressions. +`prec_inner_prod` computes the double precision inner product of the +vector expressions`.` + +===== Definition + +Defined in the header vector_expression.hpp. + +===== Type requirements + +* `E1` is a model of link:#vector_expression[Vector Expression] . +* `E2` is a model of link:#vector_expression[Vector Expression] . + +===== Preconditions + +* `e1 ().size () == e2 ().size ()` + +===== Complexity + +Linear depending from the size of the vector expressions. + +===== Examples + +[source,cpp] +.... +#include + +int main () { + using namespace boost::numeric::ublas; + vector v1 (3), v2 (3); + for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i) + v1 (i) = v2 (i) = i; + + std::cout << inner_prod (v1, v2) << std::endl; +} +.... + +''''' + +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 ). diff --git a/doc/ublas/vector_proxy.adoc b/doc/ublas/vector_proxy.adoc new file mode 100644 index 000000000..f230c7da6 --- /dev/null +++ b/doc/ublas/vector_proxy.adoc @@ -0,0 +1,443 @@ +== Vector Proxies + +[[toc]] + +=== [#vector_range]#Vector Range# + +==== Description + +The templated class `vector_range` allows addressing a sub-range of a +vector's element. + +==== Example + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + vector v (3); + vector_range > vr (v, range (0, 3)); + for (unsigned i = 0; i < vr.size (); ++ i) + vr (i) = i; + std::cout << vr << std::endl; +} +.... + +==== Definition + +Defined in the header vector_proxy.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`V` |The type of vector referenced. | +|=== + +==== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +If the specified range falls outside that of the index range of the +vector, then the `vector_range` is not a well formed Vector Expression. +That is, access to an element which is outside of index range of the +vector is _undefined_. + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +==== Public base classes + +`vector_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`vector_range (vector_type &data, const range &r)` |Constructs a sub +vector. + +|`size_type start () const` |Returns the start of the sub vector. + +|`size_type size () const` |Returns the size of the sub vector. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator () (size_type i)` |Returns a reference of the +`i`-th element. + +|`const_reference operator [] (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator [] (size_type i)` |Returns a reference of the +`i`-th element. + +|`vector_range &operator = (const vector_range &vr)` |The assignment +operator. + +|`vector_range &assign_temporary (vector_range &vr)` |Assigns a +temporary. May change the vector range `vr` . + +|`template vector_range &operator = (const vector_expression &ae)` +|The extended assignment operator. + +|`template vector_range &assign (const vector_expression &ae)` +|Assigns a vector expression to the sub vector. Left and right hand side +of the assignment should be independent. + +|`template vector_range &operator += (const vector_expression &ae)` +|A computed assignment operator. Adds the vector expression to the sub +vector. + +|`template vector_range &plus_assign (const vector_expression &ae)` +|Adds a vector expression to the sub vector. Left and right hand side of +the assignment should be independent. + +|`template vector_range &operator -= (const vector_expression &ae)` +|A computed assignment operator. Subtracts the vector expression from +the sub vector. + +|`template vector_range &minus_assign (const vector_expression &ae)` +|Subtracts a vector expression from the sub vector. Left and right hand +side of the assignment should be independent. + +|`template vector_range &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the sub vector with a scalar. + +|`template vector_range &operator /= (const AT &at)` |A +computed assignment operator. Divides the sub vector through a scalar. + +|`void swap (vector_range &vr)` |Swaps the contents of the sub vectors. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `vector_range`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `vector_range`. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the `vector_range`. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +`vector_range`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`vector_range`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`vector_range`. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed `vector_range`. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed `vector_range`. +|=== + +==== Simple Projections + +===== Description + +The free `subrange` functions support the construction of vector ranges. + +===== Prototypes + +[source,cpp] +.... + template + vector_range subrange (V &data, + V::size_type start, V::size_type stop); + template + const vector_range subrange (const V &data, + V::size_type start, V::size_type stop); +.... + +==== Generic Projections + +===== Description + +The free `project` functions support the construction of vector ranges. +Existing `matrix_range` 's can be composed with a further range. The +resulting range is computed using this existing range's `compose` +function. + +===== Prototypes + +[source,cpp] +.... + template + vector_range project (V &data, const range &r); + template + const vector_range project (const V &data, const range &r); + template + vector_range project (vector_range &data, const range &r); + template + const vector_range project (const vector_range &data, const range &r); +.... + +===== Definition + +Defined in the header vector_proxy.hpp. + +===== Type requirements + +* `V` is a model of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Complexity + +Linear depending from the size of the range. + +===== Examples + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + vector v (3); + for (int i = 0; i < 3; ++ i) + project (v, range (0, 3)) (i) = i; + std::cout << project (v, range (0, 3)) << std::endl; +} +.... + +=== [#vector_slice]#Vector Slice# + +==== Description + +The templated class `vector_slice` allows addressing a slice of a +vector. + +==== Example + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + vector v (3); + vector_slice > vs (v, slice (0, 1, 3)); + for (unsigned i = 0; i < vs.size (); ++ i) + vs (i) = i; + std::cout << vs << std::endl; +} +.... + +==== Definition + +Defined in the header vector_proxy.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default +|`V` |The type of vector referenced. | +|=== + +==== Model of + +link:expression_concept.html#vector_expression[Vector Expression] . + +If the specified slice falls outside that of the index range of the +vector, then the `vector_slice` is not a well formed Vector Expression. +That is, access to an element which is outside of index range of the +vector is _undefined_. + +==== Type requirements + +None, except for those imposed by the requirements of +link:expression_concept.html#vector_expression[Vector Expression] . + +==== Public base classes + +`vector_expression >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`vector_slice (vector_type &data, const slice &s)` |Constructs a sub +vector. + +|`size_type size () const` |Returns the size of the sub vector. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator () (size_type i)` |Returns a reference of the +`i`-th element. + +|`const_reference operator [] (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator [] (size_type i)` |Returns a reference of the +`i`-th element. + +|`vector_slice &operator = (const vector_slice &vs)` |The assignment +operator. + +|`vector_slice &assign_temporary (vector_slice &vs)` |Assigns a +temporary. May change the vector slice `vs` . + +|`template vector_slice &operator = (const vector_expression &ae)` +|The extended assignment operator. + +|`template vector_slice &assign (const vector_expression &ae)` +|Assigns a vector expression to the sub vector. Left and right hand side +of the assignment should be independent. + +|`template vector_slice &operator += (const vector_expression &ae)` +|A computed assignment operator. Adds the vector expression to the sub +vector. + +|`template vector_slice &plus_assign (const vector_expression &ae)` +|Adds a vector expression to the sub vector. Left and right hand side of +the assignment should be independent. + +|`template vector_slice &operator -= (const vector_expression &ae)` +|A computed assignment operator. Subtracts the vector expression from +the sub vector. + +|`template vector_slice &minus_assign (const vector_expression &ae)` +|Subtracts a vector expression from the sub vector. Left and right hand +side of the assignment should be independent. + +|`template vector_slice &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the sub vector with a scalar. + +|`template vector_slice &operator /= (const AT &at)` |A +computed assignment operator. Divides the sub vector through a scalar. + +|`void swap (vector_slice &vs)` |Swaps the contents of the sub vectors. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `vector_slice`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `vector_slice`. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the `vector_slice`. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +`vector_slice`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`vector_slice`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`vector_slice`. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed `vector_slice`. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed `vector_slice`. +|=== + +==== Simple Projections + +===== Description + +The free `subslice` functions support the construction of vector slices. + +===== Prototypes + +[source,cpp] +.... + template + vector_slice subslice (V &data, + V::size_type start, V::difference_type stride, V::size_type size); + template + const vector_slice subslice (const V &data, + V::size_type start, V::difference_type stride, V::size_type size); +.... + +==== Generic Projections + +===== Description + +The free `project` functions support the construction of vector slices. +Existing `vector_slice` 's can be composed with a further range or +slices. The resulting slice is computed using this existing slices's +`compose` function. + +===== Prototypes + +[source,cpp] +.... + template + vector_slice project (V &data, const slice &s); + template + const vector_slice project (const V &data, const slice &s); + template + vector_slice project (vector_slice &data, const range &r); + template + const vector_slice project (const vector_slice &data, const range &r); + template + vector_slice project (vector_slice &data, const slice &s); + template + const vector_slice project (const vector_slice &data, const slice &s); +.... + +===== Definition + +Defined in the header vector_proxy.hpp. + +===== Type requirements + +* `V` is a model of +link:expression_concept.html#vector_expression[Vector Expression] . + +===== Complexity + +Linear depending from the size of the slice. + +===== Examples + +[source,cpp] +.... +#include +#include +#include + +int main () { + using namespace boost::numeric::ublas; + vector v (3); + for (int i = 0; i < 3; ++ i) + project (v, slice (0, 1, 3)) (i) = i; + std::cout << project (v, slice (0, 1, 3)) << std::endl; +} +.... + +''''' + +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 ). diff --git a/doc/ublas/vector_sparse.adoc b/doc/ublas/vector_sparse.adoc new file mode 100644 index 000000000..e22d11cfd --- /dev/null +++ b/doc/ublas/vector_sparse.adoc @@ -0,0 +1,551 @@ +== Sparse Vector + +[[toc]] + +=== [#mapped_vector]#Mapped Vector# + +==== Description + +The templated class `mapped_vector` is the base container adaptor +for sparse vectors using element maps. For a _n_-dimensional sparse +vector and __0 < = i < n__ the non-zero elements __v__~_i_~ are mapped to +consecutive elements of the associative container, i.e. for elements _k_ += __v__~_i_~_~1~_ and __k + 1 = __v__~_i_~__~2~__ of the container holds +__i__~_1_~ __< __i__~_2_~ . + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + mapped_vector v (3, 3); + for (unsigned i = 0; i < v.size (); ++ i) + v (i) = i; + std::cout << v << std::endl; +} +.... + +==== Definition + +Defined in the header vector_sparse.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the mapped vector. | + +|`A` |The type of the adapted array. link:#mapped_vector_1[[1]] +|`map_std` +|=== + +==== Model of + +link:container_concept.html#vector[Vector] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#vector[Vector] . + +==== Public base classes + +`vector_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`mapped_vector ()` |Allocates a `mapped_vector` that holds zero +elements. + +|`mapped_vector (size_type size, size_type non_zeros = 0)` |Allocates a +`mapped_vector` that holds at most `size` elements. + +|`mapped_vector (const mapped_vector &v)` |The copy constructor. + +|`template mapped_vector (size_type non_zeros, const vector_expression &ae)` +|The extended copy constructor. + +|`void resize (size_type size, bool preserve = true)` |Reallocates a +`mapped_vector` to hold at most `size` elements. The existing elements +of the `mapped_vector` are preseved when specified. + +|`size_type size () const` |Returns the size of the `mapped_vector`. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator () (size_type i)` |Returns a reference of the +`i`-th element. + +|`const_reference operator [] (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator [] (size_type i)` |Returns a reference of the +`i`-th element. + +|`mapped_vector &operator = (const mapped_vector &v)` |The assignment +operator. + +|`mapped_vector &assign_temporary (mapped_vector &v)` |Assigns a +temporary. May change the mapped vector `v` . + +|`template mapped_vector &operator = (const vector_expression &ae)` +|The extended assignment operator. + +|`template mapped_vector &assign (const vector_expression &ae)` +|Assigns a vector expression to the mapped vector. Left and right hand +side of the assignment should be independent. + +|`template mapped_vector &operator += (const vector_expression &ae)` +|A computed assignment operator. Adds the vector expression to the +mapped vector. + +|`template mapped_vector &plus_assign (const vector_expression &ae)` +|Adds a vector expression to the mapped vector. Left and right hand side +of the assignment should be independent. + +|`template mapped_vector &operator -= (const vector_expression &ae)` +|A computed assignment operator. Subtracts the vector expression from +the mapped vector. + +|`template mapped_vector &minus_assign (const vector_expression &ae)` +|Subtracts a vector expression from the mapped vector. Left and right +hand side of the assignment should be independent. + +|`template mapped_vector &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the mapped vector with a +scalar. + +|`template mapped_vector &operator /= (const AT &at)` |A +computed assignment operator. Divides the mapped vector through a +scalar. + +|`void swap (mapped_vector &v)` |Swaps the contents of the mapped +vectors. + +|`true_reference insert_element (size_type i, const_reference t)` +|Inserts the value `t` at the `i`-th element. Duplicates elements are +not allowed. + +|`void erase_element (size_type i)` |Erases the value at the `i`-th +element. + +|`void clear ()` |Clears the mapped vector. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `mapped_vector`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `mapped_vector`. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the `mapped_vector`. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +`mapped_vector`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`mapped_vector`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`mapped_vector`. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed `mapped_vector`. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed `mapped_vector`. +|=== + +==== Notes + +[#mapped_vector_1]#[1]# Supported parameters for the adapted array are +`map_array` and `map_std`. The latter is +equivalent to `std::map`. + +=== [#compressed_vector]#Compressed Vector# + +==== Description + +The templated class `compressed_vector` is the base +container adaptor for compressed vectors. For a _n_-dimensional +compressed vector and _0 <= i < n_ the non-zero elements __v__~_i_~ are +mapped to consecutive elements of the index and value container, i.e. +for elements _k_ = __v__~_i_~__~1~__ and __k + 1 = __v__~_i_~__~2~__ of +these containers holds __i__~_1_~ __< __i__~_2_~ . + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + compressed_vector v (3, 3); + for (unsigned i = 0; i < v.size (); ++ i) + v (i) = i; + std::cout << v << std::endl; +} +.... + +==== Definition + +Defined in the header vector_sparse.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the compressed vector. | + +|`IB` |The index base of the compressed vector. +link:#compressed_vector_1[[1]] |`0` + +|`IA` |The type of the adapted array for indices. +link:#compressed_vector_2[[2]] |`unbounded_array` + +|`TA` |The type of the adapted array for values. +link:#compressed_vector_2[[2]] |`unbounded_array` +|=== + +==== Model of + +link:container_concept.html#vector[Vector] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#vector[Vector] . + +==== Public base classes + +`vector_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`compressed_vector ()` |Allocates a `compressed_vector` that holds zero +elements. + +|`compressed_vector (size_type size, size_type non_zeros)` |Allocates a +`compressed_vector` that holds at most `size` elements. + +|`compressed_vector (const compressed_vector &v)` |The copy constructor. + +|`template compressed_vector (size_type non_zeros, const vector_expression &ae)` +|The extended copy constructor. + +|`void resize (size_type size, bool preserve = true)` |Reallocates a +`compressed_vector` to hold at most `size` elements. The existing +elements of the `compress_vector` are preseved when specified. + +|`size_type size () const` |Returns the size of the `compressed_vector`. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator () (size_type i)` |Returns a reference of the +`i`-th element. + +|`const_reference operator [] (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator [] (size_type i)` |Returns a reference of the +`i`-th element. + +|`compressed_vector &operator = (const compressed_vector &v)` |The +assignment operator. + +|`compressed_vector &assign_temporary (compressed_vector &v)` |Assigns a +temporary. May change the compressed vector `v`. + +|`template compressed_vector &operator = (const vector_expression &ae)` +|The extended assignment operator. + +|`template compressed_vector &assign (const vector_expression &ae)` +|Assigns a vector expression to the compressed vector. Left and right +hand side of the assignment should be independent. + +|`template compressed_vector &operator += (const vector_expression &ae)` +|A computed assignment operator. Adds the vector expression to the +compressed vector. + +|`template compressed_vector &plus_assign (const vector_expression &ae)` +|Adds a vector expression to the compressed vector. Left and right hand +side of the assignment should be independent. + +|`template compressed_vector &operator -= (const vector_expression &ae)` +|A computed assignment operator. Subtracts the vector expression from +the compressed vector. + +|`template compressed_vector &minus_assign (const vector_expression &ae)` +|Subtracts a vector expression from the compressed vector. Left and +right hand side of the assignment should be independent. + +|`template compressed_vector &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the compressed vector with a +scalar. + +|`template compressed_vector &operator /= (const AT &at)` |A +computed assignment operator. Divides the compressed vector through a +scalar. + +|`void swap (compressed_vector &v)` |Swaps the contents of the +compressed vectors. + +|`true_reference insert_element (size_type i, const_reference t)` +|Inserts the value `t` at the `i`-th element. Duplicates elements are +not allowed. + +|`void erase_element (size_type i)` |Erases the value at the `i`-th +element. + +|`void clear ()` |Clears the compressed vector. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `compressed_vector`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `compressed_vector`. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the `compressed_vector`. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +`compressed_vector`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`compressed_vector`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`compressed_vector`. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed `compressed_vector`. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed `compressed_vector`. +|=== + +==== Notes + +[#compressed_vector_1]#[1]# Supported parameters for the index base are +`0` and `1` at least. + +[#compressed_vector_2]#[2]# Supported parameters for the adapted array +are `unbounded_array<>` , `bounded_array<>` and `std::vector<>` . + +=== [#coordinate_vector]#Coordinate Vector# + +==== Description + +The templated class `coordinate_vector` is the base +container adaptor for compressed vectors. For a _n_-dimensional sorted +coordinate vector and _0 <= i < n_ the non-zero elements __v__~_i_~ are +mapped to consecutive elements of the index and value container, i.e. +for elements _k_ = __v__~_i_~__~1~__ and __k + 1 = __v__~_i_~__~2~__ of +these containers holds __i__~_1_~ __< __i__~_2_~ . + +==== Example + +[source,cpp] +.... +#include +#include + +int main () { + using namespace boost::numeric::ublas; + coordinate_vector v (3, 3); + for (unsigned i = 0; i < v.size (); ++ i) + v (i) = i; + std::cout << v << std::endl; +} +.... + +==== Definition + +Defined in the header vector_sparse.hpp. + +==== Template parameters + +[cols=",,",] +|=== +|Parameter |Description |Default + +|`T` |The type of object stored in the coordinate vector. | + +|`IB` |The index base of the coordinate vector. +link:#coordinate_vector_1[[1]] |`0` + +|`IA` |The type of the adapted array for indices. +link:#coordinate_vector_2[[2]] |`unbounded_array` + +|`TA` |The type of the adapted array for values. +link:#coordinate_vector_2[[2]] |`unbounded_array` +|=== + +==== Model of + +link:container_concept.html#vector[Vector] . + +==== Type requirements + +None, except for those imposed by the requirements of +link:container_concept.html#vector[Vector] . + +==== Public base classes + +`vector_container >` + +==== Members + +[cols=",",] +|=== +|Member |Description + +|`coordinate_vector ()` |Allocates a `coordinate_vector` that holds zero +elements. + +|`coordinate_vector (size_type size, size_type non_zeros)` |Allocates a +`coordinate_vector` that holds at most `size` elements. + +|`coordinate_vector (const coordinate_vector &v)` |The copy constructor. + +|`template coordinate_vector (size_type non_zeros, const vector_expression &ae)` +|The extended copy constructor. + +|`void resize (size_type size, bool preserve = true)` |Reallocates a +`coordinate_vector` to hold at most `size` elements. The existing +elements of the `coordinate_vector` are preseved when specified. + +|`size_type size () const` |Returns the size of the `coordinate_vector`. + +|`const_reference operator () (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator () (size_type i)` |Returns a reference of the +`i`-th element. + +|`const_reference operator [] (size_type i) const` |Returns the value of +the `i`-th element. + +|`reference operator [] (size_type i)` |Returns a reference of the +`i`-th element. + +|`coordinate_vector &operator = (const coordinate_vector &v)` |The +assignment operator. + +|`coordinate_vector &assign_temporary (coordinate_vector &v)` |Assigns a +temporary. May change the coordinate vector `v`. + +|`template coordinate_vector &operator = (const vector_expression &ae)` +|The extended assignment operator. + +|`template coordinate_vector &assign (const vector_expression &ae)` +|Assigns a vector expression to the coordinate vector. Left and right +hand side of the assignment should be independent. + +|`template coordinate_vector &operator += (const vector_expression &ae)` +|A computed assignment operator. Adds the vector expression to the +coordinate vector. + +|`template coordinate_vector &plus_assign (const vector_expression &ae)` +|Adds a vector expression to the coordinate vector. Left and right hand +side of the assignment should be independent. + +|`template coordinate_vector &operator -= (const vector_expression &ae)` +|A computed assignment operator. Subtracts the vector expression from +the coordinate vector. + +|`template coordinate_vector &minus_assign (const vector_expression &ae)` +|Subtracts a vector expression from the coordinate vector. Left and +right hand side of the assignment should be independent. + +|`template coordinate_vector &operator *= (const AT &at)` |A +computed assignment operator. Multiplies the coordinate vector with a +scalar. + +|`template coordinate_vector &operator /= (const AT &at)` |A +computed assignment operator. Divides the coordinate vector through a +scalar. + +|`void swap (coordinate_vector &v)` |Swaps the contents of the +coordinate vectors. + +|`true_reference insert_element (size_type i, const_reference t)` +|Inserts the value `t` at the `i`-th element. Duplicates elements are +not allowed. + +|`void append_element (size_type i, size_type j, const_reference t)` +|Appends the value `t` at the `i`-th element. Duplicate elements can be +appended to a `coordinate_vector`. They are merged into a single +arithmetically summed element by the `sort` function. + +|`void erase_element (size_type i)` |Erases the value at the `i`-th +element. + +|`void clear ()` |Clears the coordinate vector. + +|`const_iterator begin () const` |Returns a `const_iterator` pointing to +the beginning of the `coordinate_vector`. + +|`const_iterator end () const` |Returns a `const_iterator` pointing to +the end of the `coordinate_vector`. + +|`iterator begin ()` |Returns a `iterator` pointing to the beginning of +the `coordinate_vector`. + +|`iterator end ()` |Returns a `iterator` pointing to the end of the +`coordinate_vector`. + +|`const_reverse_iterator rbegin () const` |Returns a +`const_reverse_iterator` pointing to the beginning of the reversed +`coordinate_vector`. + +|`const_reverse_iterator rend () const` |Returns a +`const_reverse_iterator` pointing to the end of the reversed +`coordinate_vector`. + +|`reverse_iterator rbegin ()` |Returns a `reverse_iterator` pointing to +the beginning of the reversed `coordinate_vector`. + +|`reverse_iterator rend ()` |Returns a `reverse_iterator` pointing to +the end of the reversed `coordinate_vector`. +|=== + +==== Notes + +[#coordinate_vector_1]#[1]# Supported parameters for the index base are +`0` and `1` at least. + +[#coordinate_vector_2]#[2]# Supported parameters for the adapted array +are `unbounded_array<>` , `bounded_array<>` and `std::vector<>` . + +''''' + +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 ). diff --git a/doc/unbounded_array.html b/doc/unbounded_array.html deleted file mode 100644 index 3be073054..000000000 --- a/doc/unbounded_array.html +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - -Unbounded array - - -

        Unbounded Array Storage

        -
        -

        Unbounded Array

        -

        Description

        -

        The templated class unbounded_array<T, ALLOC> implements a unbounded storage array using an allocator. -The unbounded array is similar to a std::vector in that in can grow in size beyond any fixed bound. -However unbounded_array is aimed at optimal performance. Therefore unbounded_array does not model a -Sequence like std::vector does. -

        When resized unbounded_array will reallocate it's storage even if the new size requirement is smaller. It is therefore inefficient to resize a unbounded_array

        -

        Example

        -
        -#include <boost/numeric/ublas/storage.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    unbounded_array<double> a (3);
        -    for (unsigned i = 0; i < a.size (); ++ i) {
        -        a [i] = i;
        -        std::cout << a [i] << std::endl;
        -    }
        -}
        -
        -

        Definition

        -

        Defined in the header storage.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the array.
        ALLOCAn STL Allocatorstd::allocator
        -

        Model of

        -

        Storage

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        None.

        -

        Members

        -
          -
        • The description does not describe what the member actually does, this can be looked up -in the corresponding concept documentation, but instead contains a remark on the implementation of the -member inside this model of the concept.
        • -
        • Typography: -
            -
          • Members that are not part of the implemented concepts are in blue.
          • -
          -
        • -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberWhere definedDescription
        value_typeContainer
        pointerContainerDefined as value_type*
        const_pointerContainerDefined as const value_type*
        referenceContainerDefined as value_type&
        const_referenceContainerDefined as const value_type&
        size_typeContainerDefined as Alloc::size_type
        difference_typeContainerDefined as Alloc::difference_type
        iteratorContainerDefined as pointer
        const_iteratorContainerDefined as const_pointer
        revere_iteratorContainerDefined as std::reverse_iterator<iterator>
        const_revere_iteratorContainerDefined as std::reverse_iterator<const_iterator>
        allocator_typeDefined as ALLOC
        explicit unbounded_array (ALLOC &a = ALLOC())StorageCreates an unbounded_array that holds zero elements, using a specified allocator.
        explicit unbounded_array (size_type size, ALLOC &a = ALLOC())StorageCreates a uninitialized unbounded_array that holds size elements, using a specified allocator. All the elements are default constructed.
        unbounded_array (size_type size, const T& init, ALLOC& a = ALLOC())StorageCreates an initialized unbounded_array that holds size elements, using a specified allocator. All the elements are constructed from the init value.
        unbounded_array (const unbounded_array &a)ContainerThe copy constructor.
        ~unbounded_array ()ContainerDeallocates the unbounded_array itself.
        void resize (size_type n)StorageReallocates an unbounded_array to hold n elements. Values are uninitialised.
        void resize(size_type n, const T& t)StorageReallocates an unbounded_array to hold n elements. Values are copies of t -
        size_type size () constContainerReturns the size of the unbounded_array.
        const_reference operator [] (size_type i) constContainerReturns a const reference of the i -th element.
        reference operator [] (size_type i)ContainerReturns a reference of the i-th element.
        unbounded_array &operator = (const unbounded_array &a)ContainerThe assignment operator.
        unbounded_array &assign_temporary (unbounded_array &a)Assigns a temporary. May change the array a.
        void swap (unbounded_array &a)ContainerSwaps the contents of the arrays.
        const_iterator begin () constContainerReturns a const_iterator pointing to the beginning -of the unbounded_array.
        const_iterator end () constContainerReturns a const_iterator pointing to the end of -the unbounded_array.
        iterator begin ()ContainerReturns a iterator pointing to the beginning of -the unbounded_array.
        iterator end ()ContainerReturns a iterator pointing to the end of the -unbounded_array.
        const_reverse_iterator rbegin () constReversible ContainerReturns a const_reverse_iterator pointing to the beginning of the reversed unbounded_array.
        const_reverse_iterator rend () constReversible ContainerReturns a const_reverse_iterator pointing to the end of the reversed unbounded_array.
        reverse_iterator rbegin ()Reversible ContainerReturns a reverse_iterator pointing to the beginning of the reversed unbounded_array.
        reverse_iterator rend ()Reversible ContainerReturns a reverse_iterator pointing to the end of the reversed unbounded_array.
        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/vector.html b/doc/vector.html deleted file mode 100644 index 2f9569d35..000000000 --- a/doc/vector.html +++ /dev/null @@ -1,755 +0,0 @@ - - - - - - - - - -Vector - - -

        Vector

        -
        -

        Vector

        -

        Description

        -

        The templated class vector<T, A> is the base -container adaptor for dense vectors. For a n-dimensional -vector and 0 <= i < n every element -vi is mapped to the i-th -element of the container.

        -

        Example

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<double> v (3);
        -    for (unsigned i = 0; i < v.size (); ++ i)
        -        v (i) = i;
        -    std::cout << v << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header vector.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the vector.
        AThe type of the Storage array. [1]unbounded_array<T>
        -

        Model of

        -

        Vector, -RandomAccessContainer -

        -

        Type requirements

        -

        None, except for those imposed by the requirements of Vector -and RandomAccessContainer.

        -

        Public base classes

        -

        vector_container<vector<T, A> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberWhere definedDescription
        value_type -VectorExpression
        reference -VectorExpression
        const_reference -VectorExpression
        size_type -VectorExpression
        difference_type -VectorExpression
        const_iterator -VectorExpression
        iterator -VectorExpression
        const_reverse_iterator -VectorExpression
        reverse_iterator -VectorExpression
        array_type -Vector
        vector ()VectorExpressionAllocates an uninitialized vector that holds zero -elements.
        vector (size_type size)VectorAllocates an uninitialized vector that holds -size elements.
        vector (const vector &v)The copy constructor.
        template<class AE>
        -vector (const vector_expression<AE> &ae)
        The extended copy constructor.
        void resize (size_type size, bool preserve = -true)VectorReallocates a vector to hold size -elements. The existing elements of the vector are -preseved when specified.
        size_type size () constVectorExpressionReturns the size of the vector.
        size_type max_size () constRandomAccessContainerReturns the upper bound on the size of the vector.
        bool empty () constRandomAccessContainerEquivilent to size () == 0.
        const array_type& data () constVector
        array_type& data ()Vector
        const_reference operator () (size_type i) -constVectorExpressionReturns a const reference of the i --th element.
        reference operator () (size_type i)VectorExpressionReturns a reference of the i-th element.
        const_reference operator [] (size_type i) constVectorReturns a const reference of the i --th element.
        reference operator [] (size_type i)VectorReturns a reference of the i-th element.
        vector &operator = (const vector &v)VectorExpressionThe assignment operator.
        vector &assign_temporary (vector &v)VectorExpressionAssigns a temporary. May change the vector v.
        template<class AE>
        -vector &operator = (const vector_expression<AE> -&ae)
        VectorExpressionThe extended assignment operator.
        template<class AE>
        -vector &assign (const vector_expression<AE> -&ae)
        VectorExpressionAssigns a vector expression to the vector. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -vector &operator += (const vector_expression<AE> -&ae)
        VectorExpressionA computed assignment operator. Adds the vector expression to -the vector.
        template<class AE>
        -vector &plus_assign (const vector_expression<AE> -&ae)
        VectorExpressionAdds a vector expression to the vector. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -vector &operator -= (const vector_expression<AE> -&ae)
        VectorExpressionA computed assignment operator. Subtracts the vector expression -from the vector.
        template<class AE>
        -vector &minus_assign (const vector_expression<AE> -&ae)
        VectorExpressionSubtracts a vector expression from the vector. Left and right -hand side of the assignment should be independent.
        template<class AT>
        -vector &operator *= (const AT &at)
        VectorExpressionA computed assignment operator. Multiplies the vector with a -scalar.
        template<class AT>
        -vector &operator /= (const AT &at)
        VectorExpressionA computed assignment operator. Divides the vector through a -scalar.
        void swap (vector &v)VectorExpressionSwaps the contents of the vectors.
        void insert_element (size_type i, const_reference t)VectorInserts the value t at the i-th -element.
        void erase_element (size_type i)VectorErases the value at the i-th element.
        void clear ()VectorClears the vector.
        const_iterator begin () constVectorExpressionReturns a const_iterator pointing to the beginning -of the vector.
        const_iterator end () constVectorExpressionReturns a const_iterator pointing to the end of -the vector.
        iterator begin ()VectorExpressionReturns a iterator pointing to the beginning of -the vector.
        iterator end ()VectorExpressionReturns a iterator pointing to the end of the -vector.
        const_reverse_iterator rbegin () constVectorExpressionReturns a const_reverse_iterator pointing to the -beginning of the reversed vector.
        const_reverse_iterator rend () constVectorExpressionReturns a const_reverse_iterator pointing to the -end of the reversed vector.
        reverse_iterator rbegin ()VectorExpressionReturns a reverse_iterator pointing to the -beginning of the reversed vector.
        reverse_iterator rend ()VectorExpressionReturns a reverse_iterator pointing to the end of -the reversed vector.
        -

        Notes

        -

        [1] Common parameters -for the Storage array are unbounded_array<T> , -bounded_array<T> and -std::vector<T> .

        -

        Unit Vector

        -

        Description

        -

        The templated class unit_vector<T, ALLOC> represents -canonical unit vectors. For the k-th -n-dimensional canonical unit vector and 0 <= i < -n holds uki -= 0, if i <> k, and -uki = -1.

        -

        Example

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    for (int i = 0; i < 3; ++ i) {
        -        unit_vector<double> v (3, i);
        -        std::cout << v << std::endl;
        -    }
        -}
        -
        -

        Definition

        -

        Defined in the header vector.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the vector.int
        ALLOCAn STL Allocator for size_type and difference_type.std::allocator
        -

        Model of

        -

        Vector .

        -

        Type requirements

        -

        None, except for those imposed by the requirements of -Vector .

        -

        Public base classes

        -

        vector_container<unit_vector<T> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        unit_vector ()Constructs an unit_vector that holds zero -elements.
        unit_vector (size_type size, size_type index)Constructs the index-th unit_vector -that holds size elements.
        unit_vector (const unit_vector &v)The copy constructor.
        void resize (size_type size, bool preserve = -true)Resizes a unit_vector to hold size -elements. Therefore the existing elements of the -unit_vector are always preseved.
        size_type size () constReturns the size of the unit_vector.
        size_type index () constReturns the index of the unit_vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        const_reference operator [] (size_type i) -constReturns the value of the i-th element.
        unit_vector &operator = (const unit_vector -&v)The assignment operator.
        unit_vector &assign_temporary (unit_vector -&v)Assigns a temporary. May change the unit vector v -.
        void swap (unit_vector &v)Swaps the contents of the unit vectors.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the unit_vector.
        const_iterator end () constReturns a const_iterator pointing to the end of -the unit_vector.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed unit_vector.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed unit_vector.
        -

        Zero Vector

        -

        Description

        -

        The templated class zero_vector<T, ALLOC> represents -zero vectors. For a n-dimensional zero vector and 0 -<= i < n holds zi = -0.

        -

        Example

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    zero_vector<double> v (3);
        -    std::cout << v << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header vector.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the vector.int
        ALLOCAn STL Allocator for size_type and difference_type.std::allocator
        -

        Model of

        -

        Vector .

        -

        Type requirements

        -

        None, except for those imposed by the requirements of -Vector .

        -

        Public base classes

        -

        vector_container<zero_vector<T> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        zero_vector ()Constructs a zero_vector that holds zero -elements.
        zero_vector (size_type size)Constructs a zero_vector that holds -size elements.
        zero_vector (const zero_vector &v)The copy constructor.
        void resize (size_type size, bool preserve = -true)Resizes a zero_vector to hold size -elements. Therefore the existing elements of the -zero_vector are always preseved.
        size_type size () constReturns the size of the zero_vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        const_reference operator [] (size_type i) -constReturns the value of the i-th element.
        zero_vector &operator = (const zero_vector -&v)The assignment operator.
        zero_vector &assign_temporary (zero_vector -&v)Assigns a temporary. May change the zero vector v -.
        void swap (zero_vector &v)Swaps the contents of the zero vectors.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the zero_vector.
        const_iterator end () constReturns a const_iterator pointing to the end of -the zero_vector.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed zero_vector.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed zero_vector.
        -

        Scalar Vector

        -

        Description

        -

        The templated class scalar_vector<T, ALLOC> -represents scalar vectors. For a n-dimensional scalar -vector and 0 <= i < n holds -zi = s.

        -

        Example

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    scalar_vector<double> v (3);
        -    std::cout << v << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header vector.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the vector.int
        ALLOCAn STL Allocator for size_type and difference_type.std::allocator
        -

        Model of

        -

        Vector .

        -

        Type requirements

        -

        None, except for those imposed by the requirements of -Vector .

        -

        Public base classes

        -

        vector_container<scalar_vector<T> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        scalar_vector ()Constructs a scalar_vector that holds zero -elements.
        scalar_vector (size_type size, const value_type -&value)Constructs a scalar_vector that holds -size elements each of the specified value.
        scalar_vector (const scalar_vector &v)The copy constructor.
        void resize (size_type size, bool preserve = -true)Resizes a scalar_vector to hold size -elements. Therefore the existing elements of the -scalar_vector are always preseved.
        size_type size () constReturns the size of the scalar_vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        const_reference operator [] (size_type i) -constReturns the value of the i-th element.
        scalar_vector &operator = (const scalar_vector -&v)The assignment operator.
        scalar_vector &assign_temporary (scalar_vector -&v)Assigns a temporary. May change the scalar vector -v .
        void swap (scalar_vector &v)Swaps the contents of the scalar vectors.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the scalar_vector.
        const_iterator end () constReturns a const_iterator pointing to the end of -the scalar_vector.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed scalar_vector.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed scalar_vector.
        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/vector_expression.html b/doc/vector_expression.html deleted file mode 100644 index 2372ec3df..000000000 --- a/doc/vector_expression.html +++ /dev/null @@ -1,974 +0,0 @@ - - - - - - - - - -Vector Expressions - - -

        Vector Expressions

        -
        -

        Vector Expression

        -

        Description

        -

        The templated class vector_expression<E> -is required to be a public base of all classes which model the Vector Expression concept.

        -

        Definition

        -

        Defined in the header expression_types.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        EThe type of the vector expression. 
        -

        Model of

        -

        None. Not a Vector Expression! -

        -

        Type requirements

        -

        None.

        -

        Public base classes

        -

        None.

        -

        Members

        - - - - - - - - - - - - - - - -
        MemberDescription
        const expression_type &operator () () -constReturns a const reference of the expression.
        expression_type &operator () ()Returns a reference of the expression.
        -

        Notes

        -

        The range, slice and project functions have been removed. Use the free functions defined in vector proxy instead.

        - -

        Vector Container

        -

        Description

        -

        The templated class vector_container<C> -is required to be a public base of all classes which model the Vector concept. -This includes the class vector itself.

        -

        Definition

        -

        Defined in the header expression_types.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        CThe type of the vector container. 
        -

        Model of

        -

        None. Not a Vector Expression OR Vector! -

        -

        Type requirements

        -

        None.

        -

        Public base classes

        -

        vector_expression<C>

        -

        Members

        - - - - - - - - - - - - - - - -
        MemberDescription
        const container_type &operator () () -constReturns a const reference of the container.
        container_type &operator () ()Returns a reference of the container.
        - -

        Vector References

        -

        Reference

        -

        Description

        -

        The templated class vector_reference<E> -contains a reference to a vector expression.

        -

        Definition

        -

        Defined in the header vector_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        EThe type of the vector expression. 
        -

        Model of

        -

        Vector Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<vector_reference<E> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        vector_reference (expression_type &e)Constructs a reference of the expression.
        void resize (size_type size)Resizes the expression to hold at most size -elements.
        size_type size () constReturns the size of the expression.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        reference operator () (size_type i)Returns a reference of the i-th element.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the expression.
        const_iterator end () constReturns a const_iterator pointing to the end of -the expression.
        iterator begin ()Returns a iterator pointing to the beginning of -the expression.
        iterator end ()Returns a iterator pointing to the end of the -expression.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed expression.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed expression.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed expression.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed expression.
        -

        Vector Operations

        -

        Unary Operation Description

        -

        Description

        -

        The templated class vector_unary<E, F> -describes a unary vector operation.

        -

        Definition

        -

        Defined in the header vector_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        EThe type of the vector expression. 
        FThe type of the operation. 
        -

        Model of

        -

        Vector Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<vector_unary<E, F> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        vector_unary (const expression_type &e)Constructs a description of the expression.
        size_type size () constReturns the size of the expression.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the expression.
        const_iterator end () constReturns a const_iterator pointing to the end of -the expression.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed expression.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed expression.
        -

        Unary Operations

        -

        Prototypes

        -
        -template<class E, class F>
        -    struct vector_unary_traits {
        -        typedef vector_unary<typename E::const_closure_type, F> expression_type;
        -        typedef expression_type result_type;
        -     };
        -
        -    // (- v) [i] = - v [i]
        -    template<class E>
        -     typename vector_unary_traits<E, scalar_negate<typename E::value_type> >::result_type
        -    operator - (const vector_expression<E> &e);
        -
        -    // (conj v) [i] = conj (v [i])
        -    template<class E>
        -     typename vector_unary_traits<E, scalar_conj<typename E::value_type> >::result_type
        -    conj (const vector_expression<E> &e);
        -
        -    // (real v) [i] = real (v [i])
        -    template<class E>
        -     typename vector_unary_traits<E, scalar_real<typename E::value_type> >::result_type
        -    real (const vector_expression<E> &e);
        -
        -    // (imag v) [i] = imag (v [i])
        -    template<class E>
        -     typename vector_unary_traits<E, scalar_imag<typename E::value_type> >::result_type
        -    imag (const vector_expression<E> &e);
        -
        -    // (trans v) [i] = v [i]
        -    template<class E>
        -     typename vector_unary_traits<E, scalar_identity<typename E::value_type> >::result_type
        -    trans (const vector_expression<E> &e);
        -
        -    // (herm v) [i] = conj (v [i])
        -    template<class E>
        -     typename vector_unary_traits<E, scalar_conj<typename E::value_type> >::result_type
        -    herm (const vector_expression<E> &e);
        -
        -

        Description

        -

        operator - computes the additive inverse of a -vector expression. conj computes the complex conjugate -of a vector expression. real and imag -compute the real and imaginary parts of a vector expression. -trans computes the transpose of a vector expression. -herm computes the hermitian, i.e. the complex -conjugate of the transpose of a vector expression.

        -

        Definition

        -

        Defined in the header vector_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -

        None.

        -

        Complexity

        -

        Linear depending from the size of the vector expression.

        -

        Examples

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<std::complex<double> > v (3);
        -    for (unsigned i = 0; i < v.size (); ++ i)
        -        v (i) = std::complex<double> (i, i);
        -
        -    std::cout << - v << std::endl;
        -    std::cout << conj (v) << std::endl;
        -    std::cout << real (v) << std::endl;
        -    std::cout << imag (v) << std::endl;
        -    std::cout << trans (v) << std::endl;
        -    std::cout << herm (v) << std::endl;
        -}
        -
        -

        Binary Operation Description

        -

        Description

        -

        The templated class vector_binary<E1, E2, F> -describes a binary vector operation.

        -

        Definition

        -

        Defined in the header vector_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        E1The type of the first vector expression.
        E2The type of the second vector expression.
        FThe type of the operation.
        -

        Model of

        -

        Vector Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<vector_binary<E1, E2, F> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        vector_binary (const expression1_type &e1, const -expression2_type &e2)Constructs a description of the expression.
        size_type size () constReturns the size of the expression.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the expression.
        const_iterator end () constReturns a const_iterator pointing to the end of -the expression.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed expression.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed expression.
        -

        Binary Operations

        -

        Prototypes

        -
        -template<class E1, class E2, class F>
        -    struct vector_binary_traits {
        -        typedef vector_binary<typename E1::const_closure_type,
        -                               typename E2::const_closure_type, F> expression_type;
        -        typedef expression_type result_type;
        -     };
        -
        -    // (v1 + v2) [i] = v1 [i] + v2 [i]
        -    template<class E1, class E2>
        -    typename vector_binary_traits<E1, E2, scalar_plus<typename E1::value_type,
        -                                                       typename E2::value_type> >::result_type
        -    operator + (const vector_expression<E1> &e1,
        -                 const vector_expression<E2> &e2);
        -
        -    // (v1 - v2) [i] = v1 [i] - v2 [i]
        -    template<class E1, class E2>
        -    typename vector_binary_traits<E1, E2, scalar_minus<typename E1::value_type,
        -                                                        typename E2::value_type> >::result_type
        -    operator - (const vector_expression<E1> &e1,
        -                 const vector_expression<E2> &e2);
        -
        -

        Description

        -

        operator + computes the sum of two vector -expressions. operator - computes the difference of two -vector expressions.

        -

        Definition

        -

        Defined in the header vector_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -
          -
        • e1 ().size () == e2 ().size ()
        • -
        -

        Complexity

        -

        Linear depending from the size of the vector expressions.

        -

        Examples

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<double> v1 (3), v2 (3);
        -    for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)
        -        v1 (i) = v2 (i) = i;
        -
        -    std::cout << v1 + v2 << std::endl;
        -    std::cout << v1 - v2 << std::endl;
        -}
        -
        -

        Binary Outer Operation Description

        -

        Description

        -

        The templated class vector_matrix_binary<E1, E2, -F> describes a binary outer vector operation.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        E1The type of the first vector expression.
        E2The type of the second vector expression.
        FThe type of the operation.
        -

        Model of

        -

        Matrix Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        matrix_expression<vector_matrix_binary<E1, E2, F> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        vector_matrix_binary (const expression1_type &e1, -const expression2_type &e2)Constructs a description of the expression.
        size_type size1 () constReturns the number of rows.
        size_type size2 () constReturns the number of columns.
        const_reference operator () (size_type i, size_type j) -constReturns the value of the j-th element in the -i-th row.
        const_iterator1 begin1 () constReturns a const_iterator1 pointing to the -beginning of the expression.
        const_iterator1 end1 () constReturns a const_iterator1 pointing to the end of -the expression.
        const_iterator2 begin2 () constReturns a const_iterator2 pointing to the -beginning of the expression.
        const_iterator2 end2 () constReturns a const_iterator2 pointing to the end of -the expression.
        const_reverse_iterator1 rbegin1 () constReturns a const_reverse_iterator1 pointing to the -beginning of the reversed expression.
        const_reverse_iterator1 rend1 () constReturns a const_reverse_iterator1 pointing to the -end of the reversed expression.
        const_reverse_iterator2 rbegin2 () constReturns a const_reverse_iterator2 pointing to the -beginning of the reversed expression.
        const_reverse_iterator2 rend2 () constReturns a const_reverse_iterator2 pointing to the -end of the reversed expression.
        -

        Binary Outer Operations

        -

        Prototypes

        -
        -template<class E1, class E2, class F>
        -    struct vector_matrix_binary_traits {
        -        typedef vector_matrix_binary<typename E1::const_closure_type,
        -                                      typename E2::const_closure_type, F> expression_type;
        -        typedef expression_type result_type;
        -     };
        -
        -    // (outer_prod (v1, v2)) [i] [j] = v1 [i] * v2 [j]
        -    template<class E1, class E2>
        -    typename vector_matrix_binary_traits<E1, E2, scalar_multiplies<typename E1::value_type, typename E2::value_type> >::result_type
        -    outer_prod (const vector_expression<E1> &e1,
        -                 const vector_expression<E2> &e2);
        -
        -

        Description

        -

        outer_prod computes the outer product of two vector -expressions.

        -

        Definition

        -

        Defined in the header matrix_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -

        None.

        -

        Complexity

        -

        Quadratic depending from the size of the vector expressions.

        -

        Examples

        -
        -#include <boost/numeric/ublas/matrix.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<double> v1 (3), v2 (3);
        -    for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)
        -        v1 (i) = v2 (i) = i;
        -
        -    std::cout << outer_prod (v1, v2) << std::endl;
        -}
        -
        -

        Scalar Vector Operation Description

        -

        Description

        -

        The templated classes vector_binary_scalar1<E1, E2, -F> and vector_binary_scalar2<E1, E2, -F> describe binary operations between a scalar and a -vector.

        -

        Definition

        -

        Defined in the header vector_expression.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        E1/E2The type of the scalar expression.
        E2/E1The type of the vector expression.
        FThe type of the operation.
        -

        Model of

        -

        Vector Expression -.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<vector_binary_scalar1<E1, E2, -F> > and -vector_expression<vector_binary_scalar2<E1, E2, F> -> resp.

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        vector_binary_scalar1 (const expression1_type &e1, -const expression2_type &e2)Constructs a description of the expression.
        vector_binary_scalar2 (const expression1_type &e1, -const expression2_type &e2)Constructs a description of the expression.
        size_type size () constReturns the size of the expression.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the expression.
        const_iterator end () constReturns a const_iterator pointing to the end of -the expression.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed expression.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed expression.
        -

        Scalar Vector Operations

        -

        Prototypes

        -
        -template<class T1, class E2, class F>
        -    struct vector_binary_scalar1_traits {
        -        typedef vector_binary_scalar1<scalar_const_reference<T1>,
        -                                      typename E2::const_closure_type, F> expression_type;
        -        typedef expression_type result_type;
        -    };
        -
        -    // (t * v) [i] = t * v [i]
        -    template<class T1, class E2>
        -    typename vector_binary_scalar1_traits<T1, E2, scalar_multiplies<T1, typename E2::value_type> >::result_type
        -    operator * (const T1 &e1,
        -                const vector_expression<E2> &e2);
        -
        -    template<class E1, class T2, class F>
        -    struct vector_binary_scalar2_traits {
        -        typedef vector_binary_scalar2<typename E1::const_closure_type,
        -                                      scalar_const_reference<T2>, F> expression_type;
        -        typedef expression_type result_type;
        -    };
        -
        -    // (v * t) [i] = v [i] * t
        -    template<class E1, class T2>
        -    typename vector_binary_scalar2_traits<E1, T2, scalar_multiplies<typename E1::value_type, T2> >::result_type
        -    operator * (const vector_expression<E1> &e1,
        -                const T2 &e2);
        -
        -    // (v / t) [i] = v [i] / t
        -    template<class E1, class T2>
        -    typename vector_binary_scalar2_traits<E1, T2, scalar_divides<typename E1::value_type, T2> >::result_type
        -    operator / (const vector_expression<E1> &e1,
        -                const T2 &e2);
        -
        -

        Description

        -

        operator * computes the product of a scalar and a -vector expression. operator / multiplies the vector -with the reciprocal of the scalar.

        -

        Definition

        -

        Defined in the header vector_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -

        None.

        -

        Complexity

        -

        Linear depending from the size of the vector expression.

        -

        Examples

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<double> v (3);
        -    for (unsigned i = 0; i < v.size (); ++ i)
        -        v (i) = i;
        -
        -    std::cout << 2.0 * v << std::endl;
        -    std::cout << v * 2.0 << std::endl;
        -}
        -
        -

        Vector Reductions

        -

        Unary Reductions

        -

        Prototypes

        -
        -template<class E, class F>
        -    struct vector_scalar_unary_traits {
        -         typedef typename F::result_type result_type;
        -    };
        -
        -    // sum v = sum (v [i])
        -    template<class E>
        -    typename vector_scalar_unary_traits<E, vector_sum<typename E::value_type> >::result_type
        -    sum (const vector_expression<E> &e);
        -
        -    // norm_1 v = sum (abs (v [i]))
        -    template<class E>
        -    typename vector_scalar_unary_traits<E, vector_norm_1<typename E::value_type> >::result_type
        -    norm_1 (const vector_expression<E> &e);
        -
        -    // norm_2 v = sqrt (sum (v [i] * v [i]))
        -    template<class E>
        -    typename vector_scalar_unary_traits<E, vector_norm_2<typename E::value_type> >::result_type
        -    norm_2 (const vector_expression<E> &e);
        -
        -    // norm_2_square v = sum (v [i] * v [i])
        -    template<class E>
        -    typename vector_scalar_unary_traits<E, vector_norm_2_square<typename E::value_type> >::result_type
        -    norm_2_square (const vector_expression<E> &e);
        -
        -    // norm_inf v = max (abs (v [i]))
        -    template<class E>
        -    typename vector_scalar_unary_traits<E, vector_norm_inf<typename E::value_type> >::result_type
        -    norm_inf (const vector_expression<E> &e);
        -
        -    // index_norm_inf v = min (i: abs (v [i]) == max (abs (v [i])))
        -    template<class E>
        -    typename vector_scalar_unary_traits<E, vector_index_norm_inf<typename E::value_type> >::result_type
        -    index_norm_inf (const vector_expression<E> &e);
        -
        -

        Description

        -

        sum computes the sum of the vector expression's -elements. norm_1, norm_2 and -norm_inf compute the corresponding -||.||1, -||.||2 and -||.||inf vector norms. -index_norm_1 computes the index of the vector -expression's first element having maximal absolute value.

        -

        Definition

        -

        Defined in the header vector_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -

        None.

        -

        Complexity

        -

        Linear depending from the size of the vector expression.

        -

        Examples

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<double> v (3);
        -    for (unsigned i = 0; i < v.size (); ++ i)
        -        v (i) = i;
        -
        -    std::cout << sum (v) << std::endl;
        -    std::cout << norm_1 (v) << std::endl;
        -    std::cout << norm_2 (v) << std::endl;
        -    std::cout << norm_inf (v) << std::endl;
        -    std::cout << index_norm_inf (v) << std::endl;
        -}
        -
        -

        Binary Reductions

        -

        Prototypes

        -
        -template<class E1, class E2, class F>
        -    struct vector_scalar_binary_traits {
        -        typedef typename F::result_type result_type;
        -    };
        -
        -    // inner_prod (v1, v2) = sum (v1 [i] * v2 [i])
        -    template<class E1, class E2>
        -    typename vector_scalar_binary_traits<E1, E2, vector_inner_prod<typename E1::value_type,
        -                                                                   typename E2::value_type,
        -                                                                   typename promote_traits<typename E1::value_type,
        -                                                                                           typename E2::value_type>::promote_type> >::result_type
        -    inner_prod (const vector_expression<E1> &e1,
        -                const vector_expression<E2> &e2);
        -
        -    template<class E1, class E2>
        -    typename vector_scalar_binary_traits<E1, E2, vector_inner_prod<typename E1::value_type,
        -                                                                   typename E2::value_type,
        -                                                                   typename type_traits<typename promote_traits<typename E1::value_type,
        -                                                                                                                typename E2::value_type>::promote_type>::precision_type> >::result_type
        -    prec_inner_prod (const vector_expression<E1> &e1,
        -                     const vector_expression<E2> &e2);
        -
        -

        Description

        -

        inner_prod computes the inner product of the vector -expressions. prec_inner_prod computes the double -precision inner product of the vector expressions.

        -

        Definition

        -

        Defined in the header vector_expression.hpp.

        -

        Type requirements

        - -

        Preconditions

        -
          -
        • e1 ().size () == e2 ().size ()
        • -
        -

        Complexity

        -

        Linear depending from the size of the vector expressions.

        -

        Examples

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<double> v1 (3), v2 (3);
        -    for (unsigned i = 0; i < std::min (v1.size (), v2.size ()); ++ i)
        -        v1 (i) = v2 (i) = i;
        -
        -    std::cout << inner_prod (v1, v2) << std::endl;
        -}
        -
        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/vector_proxy.html b/doc/vector_proxy.html deleted file mode 100644 index a8a7376cd..000000000 --- a/doc/vector_proxy.html +++ /dev/null @@ -1,527 +0,0 @@ - - - - - - - - - -Vector Proxies - - -

        Vector Proxies

        -
        -

        Vector Range

        -

        Description

        -

        The templated class vector_range<V> allows -addressing a sub-range of a vector's element.

        -

        Example

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/vector_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<double> v (3);
        -    vector_range<vector<double> > vr (v, range (0, 3));
        -    for (unsigned i = 0; i < vr.size (); ++ i)
        -        vr (i) = i;
        -    std::cout << vr << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header vector_proxy.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        VThe type of vector referenced.
        -

        Model of

        -

        Vector Expression -.

        -

        If the specified range falls outside that of the index range of -the vector, then the vector_range is not a well formed -Vector Expression. That is, access to an element which is outside -of index range of the vector is undefined.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<vector_range<V> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        vector_range (vector_type &data, const range -&r)Constructs a sub vector.
        size_type start () constReturns the start of the sub vector.
        size_type size () constReturns the size of the sub vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        reference operator () (size_type i)Returns a reference of the i-th element.
        const_reference operator [] (size_type i) -constReturns the value of the i-th element.
        reference operator [] (size_type i)Returns a reference of the i-th element.
        vector_range &operator = (const vector_range -&vr)The assignment operator.
        vector_range &assign_temporary (vector_range -&vr)Assigns a temporary. May change the vector range -vr .
        template<class AE>
        -vector_range &operator = (const vector_expression<AE> -&ae)
        The extended assignment operator.
        template<class AE>
        -vector_range &assign (const vector_expression<AE> -&ae)
        Assigns a vector expression to the sub vector. Left and right -hand side of the assignment should be independent.
        template<class AE>
        -vector_range &operator += (const vector_expression<AE> -&ae)
        A computed assignment operator. Adds the vector expression to -the sub vector.
        template<class AE>
        -vector_range &plus_assign (const vector_expression<AE> -&ae)
        Adds a vector expression to the sub vector. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -vector_range &operator -= (const vector_expression<AE> -&ae)
        A computed assignment operator. Subtracts the vector expression -from the sub vector.
        template<class AE>
        -vector_range &minus_assign (const vector_expression<AE> -&ae)
        Subtracts a vector expression from the sub vector. Left and -right hand side of the assignment should be independent.
        template<class AT>
        -vector_range &operator *= (const AT &at)
        A computed assignment operator. Multiplies the sub vector with -a scalar.
        template<class AT>
        -vector_range &operator /= (const AT &at)
        A computed assignment operator. Divides the sub vector through -a scalar.
        void swap (vector_range &vr)Swaps the contents of the sub vectors.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the vector_range.
        const_iterator end () constReturns a const_iterator pointing to the end of -the vector_range.
        iterator begin ()Returns a iterator pointing to the beginning of -the vector_range.
        iterator end ()Returns a iterator pointing to the end of the -vector_range.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed vector_range.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed vector_range.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed vector_range.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed vector_range.
        -

        Simple Projections

        -

        Description

        -

        The free subrange functions support the construction -of vector ranges.

        -

        Prototypes

        -
        
        -    template<class V>
        -    vector_range<V> subrange (V &data,
        -       V::size_type start, V::size_type stop);
        -    template<class V>
        -    const vector_range<const V> subrange (const V &data,
        -       V::size_type start, V::size_type stop);
        -
        -

        Generic Projections

        -

        Description

        -

        The free project functions support the construction -of vector ranges. Existing matrix_range's can be composed with a further range. The resulting range is computed using this existing range's compose function.

        -

        Prototypes

        -
        
        -    template<class V>
        -    vector_range<V> project (V &data, const range &r);
        -    template<class V>
        -    const vector_range<const V> project (const V &data, const range &r);
        -    template<class V>
        -    vector_range<V> project (vector_range<V> &data, const range &r);
        -    template<class V>
        -    const vector_range<V> project (const vector_range<V> &data, const range &r);
        -
        -

        Definition

        -

        Defined in the header vector_proxy.hpp.

        -

        Type requirements

        - -

        Complexity

        -

        Linear depending from the size of the range.

        -

        Examples

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/vector_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<double> v (3);
        -    for (int i = 0; i < 3; ++ i)
        -        project (v, range (0, 3)) (i) = i;
        -    std::cout << project (v, range (0, 3)) << std::endl;
        -}
        -
        -

        Vector Slice

        -

        Description

        -

        The templated class vector_slice<V> allows -addressing a slice of a vector.

        -

        Example

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/vector_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<double> v (3);
        -    vector_slice<vector<double> > vs (v, slice (0, 1, 3));
        -    for (unsigned i = 0; i < vs.size (); ++ i)
        -        vs (i) = i;
        -    std::cout << vs << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header vector_proxy.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        VThe type of vector referenced.
        -

        Model of

        -

        Vector Expression -.

        -

        If the specified slice falls outside that of the index range of -the vector, then the vector_slice is not a well formed -Vector Expression. That is, access to an element which is outside -of index range of the vector is undefined.

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_expression<vector_slice<V> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        vector_slice (vector_type &data, const slice -&s)Constructs a sub vector.
        size_type size () constReturns the size of the sub vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        reference operator () (size_type i)Returns a reference of the i-th element.
        const_reference operator [] (size_type i) -constReturns the value of the i-th element.
        reference operator [] (size_type i)Returns a reference of the i-th element.
        vector_slice &operator = (const vector_slice -&vs)The assignment operator.
        vector_slice &assign_temporary (vector_slice -&vs)Assigns a temporary. May change the vector slice -vs .
        template<class AE>
        -vector_slice &operator = (const vector_expression<AE> -&ae)
        The extended assignment operator.
        template<class AE>
        -vector_slice &assign (const vector_expression<AE> -&ae)
        Assigns a vector expression to the sub vector. Left and right -hand side of the assignment should be independent.
        template<class AE>
        -vector_slice &operator += (const vector_expression<AE> -&ae)
        A computed assignment operator. Adds the vector expression to -the sub vector.
        template<class AE>
        -vector_slice &plus_assign (const vector_expression<AE> -&ae)
        Adds a vector expression to the sub vector. Left and right hand -side of the assignment should be independent.
        template<class AE>
        -vector_slice &operator -= (const vector_expression<AE> -&ae)
        A computed assignment operator. Subtracts the vector expression -from the sub vector.
        template<class AE>
        -vector_slice &minus_assign (const vector_expression<AE> -&ae)
        Subtracts a vector expression from the sub vector. Left and -right hand side of the assignment should be independent.
        template<class AT>
        -vector_slice &operator *= (const AT &at)
        A computed assignment operator. Multiplies the sub vector with -a scalar.
        template<class AT>
        -vector_slice &operator /= (const AT &at)
        A computed assignment operator. Divides the sub vector through -a scalar.
        void swap (vector_slice &vs)Swaps the contents of the sub vectors.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the vector_slice.
        const_iterator end () constReturns a const_iterator pointing to the end of -the vector_slice.
        iterator begin ()Returns a iterator pointing to the beginning of -the vector_slice.
        iterator end ()Returns a iterator pointing to the end of the -vector_slice.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed vector_slice.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed vector_slice.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed vector_slice.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed vector_slice.
        -

        Simple Projections

        -

        Description

        -

        The free subslice functions support the construction -of vector slices.

        -

        Prototypes

        -
        
        -    template<class V>
        -    vector_slice<V> subslice (V &data,
        -       V::size_type start, V::difference_type stride, V::size_type size);
        -    template<class V>
        -    const vector_slice<const V> subslice (const V &data,
        -       V::size_type start, V::difference_type stride, V::size_type size);
        -
        -

        Generic Projections

        -

        Description

        -

        The free project functions support the construction -of vector slices. Existing vector_slice's can be composed with a further range or slices. The resulting slice is computed using this existing slices's compose function.

        -

        Prototypes

        -
        
        -    template<class V>
        -    vector_slice<V> project (V &data, const slice &s);
        -    template<class V>
        -    const vector_slice<const V> project (const V &data, const slice &s);
        -    template<class V>
        -    vector_slice<V> project (vector_slice<V> &data, const range &r);
        -    template<class V>
        -    const vector_slice<V> project (const vector_slice<V> &data, const range &r);
        -    template<class V>
        -    vector_slice<V> project (vector_slice<V> &data, const slice &s);
        -    template<class V>
        -    const vector_slice<V> project (const vector_slice<V> &data, const slice &s);
        -
        -

        Definition

        -

        Defined in the header vector_proxy.hpp.

        -

        Type requirements

        - -

        Complexity

        -

        Linear depending from the size of the slice.

        -

        Examples

        -
        -#include <boost/numeric/ublas/vector.hpp>
        -#include <boost/numeric/ublas/vector_proxy.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    vector<double> v (3);
        -    for (int i = 0; i < 3; ++ i)
        -        project (v, slice (0, 1, 3)) (i) = i;
        -    std::cout << project (v, slice (0, 1, 3)) << std::endl;
        -}
        -
        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/doc/vector_sparse.html b/doc/vector_sparse.html deleted file mode 100644 index 32279b0e9..000000000 --- a/doc/vector_sparse.html +++ /dev/null @@ -1,800 +0,0 @@ - - - - - - - - - - - - -

        Sparse Vector

        -
        -

        Mapped Vector

        -

        Description

        -

        The templated class mapped_vector<T, A> is -the base container adaptor for sparse vectors using element maps. For a -n-dimensional sparse vector and 0 <= i < n -the non-zero elements vi are mapped to -consecutive elements of the associative container, i.e. for -elements k = -vi1and -k + 1 = -vi2of the -container holds i1 < -i2.

        -

        Example

        -
        -#include <boost/numeric/ublas/vector_sparse.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    mapped_vector<double> v (3, 3);
        -    for (unsigned i = 0; i < v.size (); ++ i)
        -        v (i) = i;
        -    std::cout << v << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header vector_sparse.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the mapped vector.
        AThe type of the adapted array. [1]map_std<std::size_t, T>
        -

        Model of

        -

        Vector .

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_container<mapped_vector<T, A> ->

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        mapped_vector ()Allocates a mapped_vector that holds zero -elements.
        mapped_vector (size_type size, size_type -non_zeros = 0)Allocates a mapped_vector that holds at most -size elements.
        mapped_vector (const mapped_vector &v)The copy constructor.
        template<class AE>
        -mapped_vector (size_type non_zeros, const -vector_expression<AE> &ae)
        The extended copy constructor.
        void resize (size_type size, bool -preserve = true)Reallocates a mapped_vector to hold at most -size elements. The existing elements of the -mapped_vector are preseved when specified.
        size_type size () constReturns the size of the mapped_vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        reference operator () (size_type i)Returns a reference of the i-th element.
        const_reference operator [] (size_type i) -constReturns the value of the i-th element.
        reference operator [] (size_type i)Returns a reference of the i-th element.
        mapped_vector &operator = (const mapped_vector -&v)The assignment operator.
        mapped_vector &assign_temporary (mapped_vector -&v)Assigns a temporary. May change the mapped vector -v .
        template<class AE>
        -mapped_vector &operator = (const vector_expression<AE> -&ae)
        The extended assignment operator.
        template<class AE>
        -mapped_vector &assign (const vector_expression<AE> -&ae)
        Assigns a vector expression to the mapped vector. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -mapped_vector &operator += (const vector_expression<AE> -&ae)
        A computed assignment operator. Adds the vector expression to -the mapped vector.
        template<class AE>
        -mapped_vector &plus_assign (const vector_expression<AE> -&ae)
        Adds a vector expression to the mapped vector. Left and right -hand side of the assignment should be independent.
        template<class AE>
        -mapped_vector &operator -= (const vector_expression<AE> -&ae)
        A computed assignment operator. Subtracts the vector expression -from the mapped vector.
        template<class AE>
        -mapped_vector &minus_assign (const vector_expression<AE> -&ae)
        Subtracts a vector expression from the mapped vector. Left and -right hand side of the assignment should be independent.
        template<class AT>
        -mapped_vector &operator *= (const AT &at)
        A computed assignment operator. Multiplies the mapped vector -with a scalar.
        template<class AT>
        -mapped_vector &operator /= (const AT &at)
        A computed assignment operator. Divides the mapped vector -through a scalar.
        void swap (mapped_vector &v)Swaps the contents of the mapped vectors.
        true_reference insert_element (size_type i, const_reference t)Inserts the value t at the i-th -element. Duplicates elements are not allowed.
        void erase_element (size_type i)Erases the value at the i-th element.
        void clear ()Clears the mapped vector.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the mapped_vector.
        const_iterator end () constReturns a const_iterator pointing to the end of -the mapped_vector.
        iterator begin ()Returns a iterator pointing to the beginning of -the mapped_vector.
        iterator end ()Returns a iterator pointing to the end of the -mapped_vector.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed mapped_vector.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed mapped_vector.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed mapped_vector.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed mapped_vector.
        -

        Notes

        -

        [1] Supported -parameters for the adapted array are -map_array<std::size_t, T> and -map_std<std::size_t, T>. The latter is -equivalent to std::map<std::size_t, T>.

        -

        Compressed Vector

        -

        Description

        -

        The templated class compressed_vector<T, IB, IA, -TA> is the base container adaptor for compressed vectors. -For a n-dimensional compressed vector and 0 <= i -< n the non-zero elements vi -are mapped to consecutive elements of the index and value -container, i.e. for elements k = -vi1and -k + 1 = -vi2of these -containers holds i1 < -i2.

        -

        Example

        -
        -#include <boost/numeric/ublas/vector_sparse.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    compressed_vector<double> v (3, 3);
        -    for (unsigned i = 0; i < v.size (); ++ i)
        -        v (i) = i;
        -    std::cout << v << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header vector_sparse.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the compressed vector.
        IBThe index base of the compressed vector. [1]0
        IAThe type of the adapted array for indices. [2]unbounded_array<std::size_t>
        TAThe type of the adapted array for values. [2]unbounded_array<T>
        -

        Model of

        -

        Vector .

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_container<compressed_vector<T, IB, IA, -TA> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        compressed_vector ()Allocates a compressed_vector that holds zero -elements.
        compressed_vector (size_type size, size_type -non_zeros)Allocates a compressed_vector that holds at most -size elements.
        compressed_vector (const compressed_vector -&v)The copy constructor.
        template<class AE>
        -compressed_vector (size_type non_zeros, const -vector_expression<AE> &ae)
        The extended copy constructor.
        void resize (size_type size, bool -preserve = true)Reallocates a compressed_vector to hold at most -size elements. The existing elements of the -compress_vector are preseved when specified.
        size_type size () constReturns the size of the compressed_vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        reference operator () (size_type i)Returns a reference of the i-th element.
        const_reference operator [] (size_type i) -constReturns the value of the i-th element.
        reference operator [] (size_type i)Returns a reference of the i-th element.
        compressed_vector &operator = (const -compressed_vector &v)The assignment operator.
        compressed_vector &assign_temporary -(compressed_vector &v)Assigns a temporary. May change the compressed vector -v.
        template<class AE>
        -compressed_vector &operator = (const -vector_expression<AE> &ae)
        The extended assignment operator.
        template<class AE>
        -compressed_vector &assign (const vector_expression<AE> -&ae)
        Assigns a vector expression to the compressed vector. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -compressed_vector &operator += (const -vector_expression<AE> &ae)
        A computed assignment operator. Adds the vector expression to -the compressed vector.
        template<class AE>
        -compressed_vector &plus_assign (const -vector_expression<AE> &ae)
        Adds a vector expression to the compressed vector. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -compressed_vector &operator -= (const -vector_expression<AE> &ae)
        A computed assignment operator. Subtracts the vector expression -from the compressed vector.
        template<class AE>
        -compressed_vector &minus_assign (const -vector_expression<AE> &ae)
        Subtracts a vector expression from the compressed vector. Left -and right hand side of the assignment should be independent.
        template<class AT>
        -compressed_vector &operator *= (const AT &at)
        A computed assignment operator. Multiplies the compressed -vector with a scalar.
        template<class AT>
        -compressed_vector &operator /= (const AT &at)
        A computed assignment operator. Divides the compressed vector -through a scalar.
        void swap (compressed_vector &v)Swaps the contents of the compressed vectors.
        true_reference insert_element (size_type i, const_reference t)Inserts the value t at the i-th -element. Duplicates elements are not allowed.
        void erase_element (size_type i)Erases the value at the i-th element.
        void clear ()Clears the compressed vector.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the compressed_vector.
        const_iterator end () constReturns a const_iterator pointing to the end of -the compressed_vector.
        iterator begin ()Returns a iterator pointing to the beginning of -the compressed_vector.
        iterator end ()Returns a iterator pointing to the end of the -compressed_vector.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed compressed_vector.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed compressed_vector.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed compressed_vector.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed compressed_vector.
        -

        Notes

        -

        [1] -Supported parameters for the index base are 0 and -1 at least.

        -

        [2] -Supported parameters for the adapted array are -unbounded_array<> , -bounded_array<> and -std::vector<> .

        -

        Coordinate Vector

        -

        Description

        -

        The templated class coordinate_vector<T, IB, IA, -TA> is the base container adaptor for compressed vectors. -For a n-dimensional sorted coordinate vector and 0 -<= i < n the non-zero elements -vi are mapped to consecutive elements -of the index and value container, i.e. for elements k = -vi1and -k + 1 = -vi2of these -containers holds i1 < -i2.

        -

        Example

        -
        -#include <boost/numeric/ublas/vector_sparse.hpp>
        -#include <boost/numeric/ublas/io.hpp>
        -
        -int main () {
        -    using namespace boost::numeric::ublas;
        -    coordinate_vector<double> v (3, 3);
        -    for (unsigned i = 0; i < v.size (); ++ i)
        -        v (i) = i;
        -    std::cout << v << std::endl;
        -}
        -
        -

        Definition

        -

        Defined in the header vector_sparse.hpp.

        -

        Template parameters

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ParameterDescriptionDefault
        TThe type of object stored in the coordinate vector.
        IBThe index base of the coordinate vector. [1]0
        IAThe type of the adapted array for indices. [2]unbounded_array<std::size_t>
        TAThe type of the adapted array for values. [2]unbounded_array<T>
        -

        Model of

        -

        Vector .

        -

        Type requirements

        -

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

        -

        Public base classes

        -

        vector_container<coordinate_vector<T, IB, IA, -TA> >

        -

        Members

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        MemberDescription
        coordinate_vector ()Allocates a coordinate_vector that holds zero -elements.
        coordinate_vector (size_type size, size_type -non_zeros)Allocates a coordinate_vector that holds at most -size elements.
        coordinate_vector (const coordinate_vector -&v)The copy constructor.
        template<class AE>
        -coordinate_vector (size_type non_zeros, const -vector_expression<AE> &ae)
        The extended copy constructor.
        void resize (size_type size, bool -preserve = true)Reallocates a coordinate_vector to hold at most -size elements. The existing elements of the -coordinate_vector are preseved when specified.
        size_type size () constReturns the size of the coordinate_vector.
        const_reference operator () (size_type i) -constReturns the value of the i-th element.
        reference operator () (size_type i)Returns a reference of the i-th element.
        const_reference operator [] (size_type i) -constReturns the value of the i-th element.
        reference operator [] (size_type i)Returns a reference of the i-th element.
        coordinate_vector &operator = (const -coordinate_vector &v)The assignment operator.
        coordinate_vector &assign_temporary -(coordinate_vector &v)Assigns a temporary. May change the coordinate vector -v.
        template<class AE>
        -coordinate_vector &operator = (const -vector_expression<AE> &ae)
        The extended assignment operator.
        template<class AE>
        -coordinate_vector &assign (const vector_expression<AE> -&ae)
        Assigns a vector expression to the coordinate vector. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -coordinate_vector &operator += (const -vector_expression<AE> &ae)
        A computed assignment operator. Adds the vector expression to -the coordinate vector.
        template<class AE>
        -coordinate_vector &plus_assign (const -vector_expression<AE> &ae)
        Adds a vector expression to the coordinate vector. Left and -right hand side of the assignment should be independent.
        template<class AE>
        -coordinate_vector &operator -= (const -vector_expression<AE> &ae)
        A computed assignment operator. Subtracts the vector expression -from the coordinate vector.
        template<class AE>
        -coordinate_vector &minus_assign (const -vector_expression<AE> &ae)
        Subtracts a vector expression from the coordinate vector. Left -and right hand side of the assignment should be independent.
        template<class AT>
        -coordinate_vector &operator *= (const AT &at)
        A computed assignment operator. Multiplies the coordinate -vector with a scalar.
        template<class AT>
        -coordinate_vector &operator /= (const AT &at)
        A computed assignment operator. Divides the coordinate vector -through a scalar.
        void swap (coordinate_vector &v)Swaps the contents of the coordinate vectors.
        true_reference insert_element (size_type i, const_reference t)Inserts the value t at the i-th -element. Duplicates elements are not allowed.
        void append_element (size_type i, size_type j, const_reference t)Appends the value t at the i-th element. -Duplicate elements can be appended to a coordinate_vector. They are merged into a single -arithmetically summed element by the sort function.
        void erase_element (size_type i)Erases the value at the i-th element.
        void clear ()Clears the coordinate vector.
        const_iterator begin () constReturns a const_iterator pointing to the beginning -of the coordinate_vector.
        const_iterator end () constReturns a const_iterator pointing to the end of -the coordinate_vector.
        iterator begin ()Returns a iterator pointing to the beginning of -the coordinate_vector.
        iterator end ()Returns a iterator pointing to the end of the -coordinate_vector.
        const_reverse_iterator rbegin () constReturns a const_reverse_iterator pointing to the -beginning of the reversed coordinate_vector.
        const_reverse_iterator rend () constReturns a const_reverse_iterator pointing to the -end of the reversed coordinate_vector.
        reverse_iterator rbegin ()Returns a reverse_iterator pointing to the -beginning of the reversed coordinate_vector.
        reverse_iterator rend ()Returns a reverse_iterator pointing to the end of -the reversed coordinate_vector.
        -

        Notes

        -

        [1] -Supported parameters for the index base are 0 and -1 at least.

        -

        [2] -Supported parameters for the adapted array are -unbounded_array<> , -bounded_array<> and -std::vector<> .

        -
        -

        Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
        - 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 - ). -

        - - - diff --git a/index.html b/index.html index 16cd00158..44928f8ff 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,32 @@ + - + + + +

        Automatic redirection failed, please go to -doc/index.html  


        -

        Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)

        +doc/html/ublas.html. +

        + \ No newline at end of file