From 6712bf01f03a023344ac359b38563aed9b10e2ba Mon Sep 17 00:00:00 2001
From: Michael Stevens
dropped from sections
---
doc/banded.htm | 46 +-
doc/blas.htm | 446 +++++++++++++++++++
doc/doxygen.css | 218 ++++++++++
doc/functions.htm | 141 +++---
doc/hermitian.htm | 80 ++--
doc/index.htm | 49 ++-
doc/matrix.htm | 70 +--
doc/matrix_expression.htm | 828 ++++++++++++++++++------------------
doc/matrix_proxy.htm | 276 ++++++------
doc/matrix_sparse.htm | 64 +--
doc/operations_overview.htm | 201 +++++++++
doc/products.htm | 312 ++++++++++++++
doc/storage.htm | 74 ++--
doc/storage_sparse.htm | 40 +-
doc/symmetric.htm | 62 +--
doc/triangular.htm | 34 +-
doc/types_overview.htm | 571 +++++++++++++++++++++++++
doc/vector.htm | 72 ++--
doc/vector_expression.htm | 430 +++++++++----------
doc/vector_proxy.htm | 106 ++---
doc/vector_sparse.htm | 58 +--
21 files changed, 2958 insertions(+), 1220 deletions(-)
create mode 100644 doc/blas.htm
create mode 100644 doc/doxygen.css
create mode 100644 doc/operations_overview.htm
create mode 100644 doc/products.htm
create mode 100644 doc/types_overview.htm
diff --git a/doc/banded.htm b/doc/banded.htm
index e8eaa1ff..3f5aecac 100644
--- a/doc/banded.htm
+++ b/doc/banded.htm
@@ -24,17 +24,17 @@ n)-dimensional banded matrix with l lower and
storage of banded matrices is packed.
-#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;
-}
+#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; +}
Defined in the header banded.hpp.
@@ -321,18 +321,18 @@ Adaptor banded matrix adaptor for other matrices.-#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;
-}
+#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; +}
Defined in the header banded.hpp.
diff --git a/doc/blas.htm b/doc/blas.htm new file mode 100644 index 00000000..c37ac77b --- /dev/null +++ b/doc/blas.htm @@ -0,0 +1,446 @@ + + + + + +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. | |
+
|
+ ||||||||||||||||||||
| + + | +
+ triangular matrix multiplication + |
+
+
|
+ ||||||||||||||||||||
| + + | +
+
+ +triangular solve m2 * x = t * m1 in place, m2 is a triangular matrix + + |
+
+
|
+ ||||||||||||||||||||||||
| + + | +
+
+ +general matrix multiplication + + |
+
+
|
+ ||||||||||||||||||||
| + + | +
+
+ +symmetric rank k update: m1 = t * m1 + t2 * (m2 * m2T) + +
|
+
+
|
+ ||||||||||||||||||||
| + + | +
+
+ +hermitian rank k update: m1 = t * m1 + t2 * (m2 * m2H) + +
|
+
+
|
+ ||||||||||||||||||||||||
| + + | +
+
+ +generalized symmetric rank k update: m1 = t1 * m1 + t2 * (m2 * m3T) + t2 * (m3 * m2T) + +
|
+
+
|
+ ||||||||||||||||||||||||
| + + | +
+
+ +generalized hermitian rank k update: m1 = t1 * m1 + t2 * (m2 * m3H) + (m3 * (t2 * m2)H) + +
|
+
Copyright (©) 2000-2004 Michael Stevens, Mathias Koch,
+Joerg Walter, Gunter Winkler
+Permission to copy, use, modify, sell and distribute this document
+is granted provided this copyright notice appears in all copies.
+This document is provided ``as is'' without express or implied
+warranty, and with no claim as to its suitability for any
+purpose.
Last revised: 2004-07-26
+ + + diff --git a/doc/doxygen.css b/doc/doxygen.css new file mode 100644 index 00000000..dc9da522 --- /dev/null +++ b/doc/doxygen.css @@ -0,0 +1,218 @@ +H1 { + text-align: center; + font-family: Geneva, Arial, Helvetica, sans-serif; +} +H2 { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +CAPTION { font-weight: bold } +DIV.qindex { + width: 100%; + background-color: #eeeeff; + border: 1px solid #B0B0B0; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 120%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; + padding: 2px; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D + padding: 2px; +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; + padding: 2px; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + padding: 2px 6px; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; + padding: 2px 6px; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code { text-decoration: none; font-weight: normal; color: #1A419D} +A.codeRef { font-weight: normal; color: #1A419D} +A:hover { text-decoration: none; background-color: #f2f2ff } +DL.el { margin-left: -1cm } +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + padding: 6px; +} +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } +TD.md { background-color: #F4F4FB; font-weight: bold; } +TD.mdname1 { background-color: #F4F4FB; font-weight: bold; color: #602020; } +TD.mdname { background-color: #F4F4FB; font-weight: bold; color: #602020; width: 600px; } +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; + font-family: Geneva, Arial, Helvetica, sans-serif; +} +DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #eeeeff; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #eeeeff; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +.mdTable { + border: 1px solid #868686; + background-color: #F4F4FB; +} +.mdRow { + padding: 8px 10px; +} +.mdescLeft { + font-size: smaller; + font-style: italic; + background-color: #FAFAFA; + padding-left: 8px; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + font-size: smaller; + font-style: italic; + background-color: #FAFAFA; + padding-left: 4px; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; + padding-bottom: 0px; + padding-right: 8px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-style: solid; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-family: Geneva, Arial, Helvetica, sans-serif; + font-size: 12px; +} +.memItemRight { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-style: solid; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-family: Geneva, Arial, Helvetica, sans-serif; + font-size: 13px; +} +.search { color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #eeeeff; +} +TD.tiny { font-size: 75%; +} +a { + color: #252E78; +} +a:visited { + color: #3D2185; +} diff --git a/doc/functions.htm b/doc/functions.htm index 9674a12c..66d4370a 100644 --- a/doc/functions.htm +++ b/doc/functions.htm @@ -34,90 +34,71 @@ Overview of Matrix and Vector Operationst, t1, t2r, r1, r2range(0, 3)range(0, 3)s, s1, s2slice(0, 1, 3)slice(0, 1, 3)Note: A range r = range(start, count)
-contains all indices i with start <= i <
-start+count. A slice is something more general. The slice
-s = slice(start, stride, count) contains the indices
-start, start+stride, ..., start+(count-1)*stride. The
-stride can be any integer including 0 and -1!
-
+
C = A + B; C = A - B; C = -A;
w = u + v; w = u - v; w = -u;
C = t * A; C = A * t; C = A / t;
w = t * u; w = u * t; w = u / t;
-
-
+
-
+
C += A; C -= A;
w += u; w -= u;
C *= t; C /= t;
w *= t; w /= t;
-
-
+
-
+
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);
-
-
+
-
+
w = conj(u); w = real(u); w = imag(u);
C = trans(A); C = conj(A); C = herm(A); C = real(A); C = imag(A);
-
-
+
-
+
t = norm_inf(v); i = index_norm_inf(v);
t = norm_1(v); t = norm_2(v);
t = norm_inf(A); i = index_norm_inf(A);
t = norm_1(A); t = norm_frobenius(A);
-
-
+
-
+
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. Set the
@@ -125,24 +106,20 @@ axpy_prod(A, B, C, false); // C += A * B
w.clear() before axpy_prod. Up to now
there are some specialisation for 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); // w = A * B
-
-
+
Note: The blocksize can be any integer. However, the
total speed depends very strong on the combination of blocksize,
CPU and compiler. The function block_prod is designed
for large dense matrices.
-
+
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
@@ -151,21 +128,25 @@ because the product is computed as a sum of outer products.
-
-w = project(u, r); w = project(u, s);
-C = project(A, r1, r2); C = project(A, s1, s2);
-w = row(A, i); w = column(A, j);
-
-
+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.
+w = project(u, r); // a subvector of u specifed by the index range r
+w = project(u, s); // a subvector of u specifed by the index slice s
+C = project(A, r1, r2); // a submatrix of A specified by the two index ranges r1 and r2
+C = project(A, s1, s2); // a 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
+
There are to more ways to access some matrix elements as a vector:
-
-
-matrix_vector_range<matrix_type> (A, r1, r2);
+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
@@ -175,34 +156,38 @@ elements must lie along a diagonal.
matrix_vector_slice<matrix_type> (A, slice(0,1,2),
-slice(0,0,2));
+slice(0,0,2));
+
If you know for sure that the left hand expression and the right -hand expression have no common storage, then you can tell ublas -that there is no aliasing:
-
-
-noalias(C) = prod(A, B);
-
-
-
-Most often the right hand side of an assignement is constant.
-So you can give your compiler a hint to use const member function
-even if A is mutable. (MATRIX is the type of A.)
-This cast drastically reduces the access time of sparse matrix elements, since no
-temporary sparse element proxies are created.
-
-
-C = static_cast<const MATRIX&> A;
-
-
-
+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.
+ +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.
+
Copyright (©) 2000-2004 Joerg Walter, Mathias Koch, Gunter
Winkler, Michael Stevens
@@ -211,6 +196,6 @@ is granted provided this copyright notice appears in all copies.
This document is provided ``as is'' without express or implied
warranty, and with no claim as to its suitability for any
purpose.
Last revised: 2004-07-05
+Last revised: 2004-08-09