433 lines
14 KiB
HTML
433 lines
14 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
|
|
<link rel="stylesheet" href="../../../../boost.css" type="text/css"/>
|
|
<link rel="stylesheet" href="ublas.css" type="text/css" />
|
|
<script type="text/javascript" src="js/jquery-1.3.2.min.js" async="async" ></script>
|
|
<script type="text/javascript" src="js/jquery.toc-gw.js" async="async" ></script>
|
|
<script type="text/x-mathjax-config">
|
|
MathJax.Hub.Config({
|
|
jax: ["input/TeX", "output/HTML-CSS"],
|
|
extensions: ["tex2jax.js"],
|
|
"HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"], scale: "80" },
|
|
tex2jax: {
|
|
inlineMath: [ ["$", "$"], ["\\(","\\)"] ],
|
|
displayMath: [ ["$$","$$"], ["\\[", "\\]"] ],
|
|
processEscapes: true,
|
|
ignoreClass: "tex2jax_ignore|dno" },
|
|
TeX: { noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } } },
|
|
messageStyle: "none"
|
|
});
|
|
</script>
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js"></script>
|
|
|
|
<title>Boost Basic Linear Algebra</title>
|
|
</head>
|
|
<body>
|
|
<h1><img src="../../../../boost.png" align="middle" alt="logo"/>Basic Linear Algebra Library</h1>
|
|
<div class="toc" id="toc"></div>
|
|
|
|
<p>uBLAS is a C++ template class library that provides <a href="http://www.netlib.org/blas">BLAS</a> 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.</p>
|
|
|
|
<h2>Functionality</h2>
|
|
|
|
<p>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 <a href="http://www.sgi.com/tech/stl">STL</a> conforming iterator interface.</p>
|
|
|
|
<h2>Documentation</h2>
|
|
|
|
<ul>
|
|
<li><big><a href="overview.html">Overview</a></big>
|
|
<ul>
|
|
<li><a href="overview.html#rationale">Rationale</a>
|
|
</li>
|
|
|
|
<li><a href="overview.html#functionality">Functionality</a>
|
|
</li>
|
|
|
|
<li><a href="types_overview.html">Overview of Tensor, Matrix- and Vector Types</a>
|
|
</li>
|
|
|
|
<li><a href="operations_overview.html">Overview of Tensor, Matrix and Vector Operations</a>
|
|
</li>
|
|
|
|
<li><a href="#further_information">Effective uBLAS and further information</a>
|
|
</li>
|
|
|
|
<li><a href="options.html">Macros and Preprocessor Options</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="vector.html">Vector</a>
|
|
<ul>
|
|
<li><a href="vector.html#vector">Vector</a>
|
|
</li>
|
|
|
|
<li><a href="vector.html#unit_vector">Unit Vector</a>
|
|
</li>
|
|
|
|
<li><a href="vector.html#zero_vector">Zero Vector</a>
|
|
</li>
|
|
|
|
<li><a href="vector.html#scalar_vector">Scalar Vector</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="vector_sparse.html">Sparse Vector</a>
|
|
<ul>
|
|
<li><a href="vector_sparse.html#mapped_vector">Mapped Vector</a>
|
|
</li>
|
|
|
|
<li><a href="vector_sparse.html#compressed_vector">Compressed Vector</a>
|
|
</li>
|
|
|
|
<li><a href="vector_sparse.html#coordinate_vector">Coordinate Vector</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="vector_proxy.html">Vector Proxies</a>
|
|
<ul>
|
|
<li><a href="vector_proxy.html#vector_range">Vector Range</a>
|
|
</li>
|
|
|
|
<li><a href="vector_proxy.html#vector_slice">Vector Slice</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="vector_expression.html">Vector Expressions</a>
|
|
<ul>
|
|
<li><a href="vector_expression.html#vector_expression">Vector Expression</a>
|
|
</li>
|
|
|
|
<li><a href="vector_expression.html#vector_references">Vector References</a>
|
|
</li>
|
|
|
|
<li><a href="vector_expression.html#vector_operations">Vector Operations</a>
|
|
</li>
|
|
|
|
<li><a href="vector_expression.html#vector_reductions">Vector Reductions</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="matrix.html">Matrix</a>
|
|
<ul>
|
|
<li><a href="matrix.html#matrix">Matrix</a>
|
|
</li>
|
|
|
|
<li><a href="matrix.html#identity_matrix">Identity Matrix</a>
|
|
</li>
|
|
|
|
<li><a href="matrix.html#zero_matrix">Zero Matrix</a>
|
|
</li>
|
|
|
|
<li><a href="matrix.html#scalar_matrix">Scalar Matrix</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="triangular.html">Triangular Matrix</a>
|
|
<ul>
|
|
<li><a href="triangular.html#triangular_matrix">Triangular Matrix</a>
|
|
</li>
|
|
|
|
<li><a href="triangular.html#triangular_adaptor">Triangular Adaptor</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="symmetric.html">Symmetric Matrix</a>
|
|
<ul>
|
|
<li><a href="symmetric.html#symmetric_matrix">Symmetric Matrix</a>
|
|
</li>
|
|
|
|
<li><a href="symmetric.html#symmetric_adaptor">Symmetric Adaptor</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="hermitian.html">Hermitian Matrix</a>
|
|
<ul>
|
|
<li><a href="hermitian.html#hermitian_matrix">Hermitian Matrix</a>
|
|
</li>
|
|
|
|
<li><a href="hermitian.html#hermitian_adaptor">Hermitian Adaptor</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="banded.html">Banded Matrix</a>
|
|
<ul>
|
|
<li><a href="banded.html#banded_matrix">Banded Matrix</a>
|
|
</li>
|
|
|
|
<li><a href="banded.html#banded_adaptor">Banded Adaptor</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="matrix_sparse.html">Sparse Matrix</a>
|
|
<ul>
|
|
<li><a href="matrix_sparse.html#mapped_matrix">Mapped Matrix</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_sparse.html#compressed_matrix">Compressed Matrix</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_sparse.html#coordinate_matrix">Coordinate Matrix</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="matrix_proxy.html">Matrix Proxies</a>
|
|
<ul>
|
|
<li><a href="matrix_proxy.html#matrix_row">Matrix Row</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_proxy.html#matrix_column">Matrix Column</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_proxy.html#vector_range">Vector Range</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_proxy.html#vector_slice">Vector Slice</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_proxy.html#matrix_range">Matrix Range</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_proxy.html#matrix_slice">Matrix Slice</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="matrix_expression.html">Matrix Expressions</a>
|
|
<ul>
|
|
<li><a href="matrix_expression.html#matrix_expression">Matrix Expression</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_expression.html#matrix_references">Matrix References</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_expression.html#matrix_operations">Matrix Operations</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_expression.html#matrix_vector_operations">Matrix Vector Operations</a>
|
|
</li>
|
|
|
|
<li><a href="matrix_expression.html#matrix_matrix_operations">Matrix Matrix Operations</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
<li><a href="tensor.html">Tensor</a>
|
|
<ul>
|
|
<li><a href="tensor.html#tensor">Tensor</a> </li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="tensor/tensor_expression.html">Tensor Expressions</a>
|
|
|
|
<ul>
|
|
<li><a href="tensor/tensor_expression.html#tensor_expression">Tensor Expression</a>
|
|
</li>
|
|
|
|
<li><a href="tensor/tensor_expression.html#binary_tensor_expression">Binary Tensor Expression</a>
|
|
</li>
|
|
|
|
<li><a href="tensor/tensor_expression.html#unary_tensor_expression">Unary Tensor Expression</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
|
|
|
|
<li>Storage and special containers
|
|
|
|
<ul>
|
|
<li><a href="unbounded_array.html">Unbounded Array</a>
|
|
</li>
|
|
|
|
<li><a href="bounded_array.html">Bounded Array</a>
|
|
</li>
|
|
|
|
<li><a href="range.html#range">Range</a>
|
|
</li>
|
|
|
|
<li><a href="range.html#slice">Slice</a>
|
|
</li>
|
|
|
|
<li><a href="tensor/extents.html#extents">Extents</a>
|
|
</li>
|
|
|
|
<li><a href="tensor/strides.html#strides">Strides</a>
|
|
</li>
|
|
|
|
</ul></li>
|
|
|
|
<li><a href="storage_sparse.html">Sparse Storage</a>
|
|
<ul>
|
|
<li><a href="storage_sparse.html#map_std">Default Standard Map</a>
|
|
</li>
|
|
|
|
<li><a href="storage_sparse.html#map_array">Map Array</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li>Operations & Functions
|
|
|
|
<ul>
|
|
<li><a href="products.html">Special Products</a>
|
|
</li>
|
|
|
|
<li><a href="blas.html">BLAS</a>
|
|
</li>
|
|
</ul></li>
|
|
|
|
<li>uBLAS Concept definitions
|
|
|
|
<ul>
|
|
<li><a href="container_concept.html">Container Concepts</a>
|
|
<ul>
|
|
<li><a href="container_concept.html#vector">Vector</a>
|
|
</li>
|
|
|
|
<li><a href="container_concept.html#matrix">Matrix</a>
|
|
</li>
|
|
|
|
<li><a href="container_concept.html#tensor">Tensor</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="expression_concept.html">Expression Concepts</a>
|
|
<ul>
|
|
<li><a href="expression_concept.html#scalar_expression">Scalar Expression</a>
|
|
</li>
|
|
|
|
<li><a href="expression_concept.html#vector_expression">Vector Expression</a>
|
|
</li>
|
|
|
|
<li><a href="expression_concept.html#matrix_expression">Matrix Expression</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
|
|
<li><a href="storage_concept.html">Storage Concept</a>
|
|
</li>
|
|
|
|
<li><a href="iterator_concept.html">Iterator Concepts</a>
|
|
<ul>
|
|
<li><a href="iterator_concept.html#indexed_bidirectional_iterator">Indexed Bidirectional Iterator</a>
|
|
</li>
|
|
|
|
<li><a href="iterator_concept.html#indexed_random_access_iterator">Indexed Random Access Iterator</a>
|
|
</li>
|
|
|
|
<li><a href="iterator_concept.html#indexed_bidirectional_cr_iterator">Indexed Bidirectional Column/Row Iterator</a>
|
|
</li>
|
|
|
|
<li><a href="iterator_concept.html#indexed_random_access_cr_iterator">Indexed Random Access Column/Row Iterator</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul></li>
|
|
</ul>
|
|
|
|
<h2>Release notes</h2>
|
|
Release notes can be found <a href="release_notes.html">here</a>.
|
|
|
|
<a name="further_information" id="further_information"></a>
|
|
<h2>Known limitations</h2>
|
|
|
|
<ul type="disc">
|
|
<li>The implementation assumes a linear memory address model.</li>
|
|
|
|
<li>Tuning was focussed on dense matrices.</li>
|
|
</ul>
|
|
|
|
<h2>Further Information</h2>
|
|
|
|
<ul>
|
|
<li><a href="https://lists.boost.org/mailman/listinfo.cgi/ublas">uBLAS mailing list</a></li>
|
|
<li><a href="https://github.com/boostorg/ublas/wiki">uBLAS wiki</a></li>
|
|
<li><a href="http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Effective_UBLAS">Effective uBLAS</a> wiki</li>
|
|
<li><a href="https://github.com/boostorg/ublas">Code</a></li>
|
|
</ul>
|
|
|
|
<h3>Authors and Credits</h3>
|
|
|
|
<p>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 <a href="http://www.boost.org">Boost</a> and all others contributors around the world. I promise I will try to add their names to this list.</p>
|
|
<p>
|
|
This library is currently maintained by David Bellot and Stefan Seefeld.
|
|
|
|
<h2>Frequently Asked Questions</h2>
|
|
|
|
<p>Q: Should I use uBLAS for new projects?<br/>
|
|
A: At the time of writing (09/2012) there are a lot of good matrix libraries available, e.g.,
|
|
<a href="http://www.simunova.com" target="_blank">MTL4</a>,
|
|
<a href="http://arma.sourceforge.net" target="_blank">armadillo</a>,
|
|
<a href="http://eigen.tuxfamily.org" target="_blank">eigen</a>. 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: <i>Availability?</i> uBLAS is part of boost
|
|
and thus available in many environments. <i>Easy to use?</i> uBLAS is easy to use for simple things, but needs decent
|
|
C++ knowledge when you leave the path. <i>Performance?</i> There are faster alternatives. <i>Cutting edge?</i> uBLAS
|
|
is more than 10 years old and missed all new stuff from C++11. </p>
|
|
|
|
<p>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?<br />
|
|
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 <code>NDEBUG</code> of <code>cassert</code> is defined. <code>NDEBUG</code> enables release mode, which in turn
|
|
uses expression templates. You can optionally define <code>BOOST_UBLAS_NDEBUG</code> to disable all bounds, structure
|
|
and similar checks of uBLAS.</p>
|
|
|
|
<p>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?<br />
|
|
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 <code>NDEBUG</code> of <code>cassert</code> is defined. <code>NDEBUG</code> disables debug mode, which is needed
|
|
to get size and type conformance checks.</p>
|
|
|
|
<p>Q: I've written some uBLAS benchmarks to measure the performance of matrix chain multiplications like <code>prod (A,
|
|
prod (B, C))</code> and see a significant performance penalty due to the use of expression templates. How can I disable
|
|
expression templates?<br />
|
|
A: You do not need to disable expression templates. Please try reintroducing temporaries using either <code>prod
|
|
(A,</code> <code><em>matrix_type</em></code> <code>(prod (B, C)))</code> or <code>prod (A,
|
|
prod<</code><code><em>matrix_type</em></code> <code>> (B, C))</code>.</p>
|
|
|
|
<hr />
|
|
|
|
<p>Copyright (©) 2000-2011 Joerg Walter, Mathias Koch, Gunter Winkler, David Bellot<br />
|
|
Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file
|
|
LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>
|
|
).</p>
|
|
<script type="text/javascript">
|
|
(function($) {
|
|
$('#toc').toc();
|
|
})(jQuery);
|
|
</script>
|
|
</body>
|
|
</html>
|