1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=us-ascii" />
6 <link rel=
"stylesheet" href=
"../../../../boost.css" type=
"text/css"/>
7 <link rel=
"stylesheet" href=
"ublas.css" type=
"text/css" />
8 <script type=
"text/javascript" src=
"js/jquery-1.3.2.min.js" async=
"async" ></script>
9 <script type=
"text/javascript" src=
"js/jquery.toc-gw.js" async=
"async" ></script>
10 <title>Boost Basic Linear Algebra
</title>
13 <h1><img src=
"../../../../boost.png" align=
"middle" alt=
"logo"/>Basic Linear Algebra Library
</h1>
14 <div class=
"toc" id=
"toc"></div>
16 <p>uBLAS is a C++ template class library that provides
<a href=
"http://www.netlib.org/blas">BLAS
</a> level
1,
2,
3
17 functionality for dense, packed and sparse matrices. The design and implementation unify mathematical notation via
18 operator overloading and efficient code generation via expression templates.
</p>
20 <h2>Functionality
</h2>
22 <p>uBLAS provides templated C++ classes for dense, unit and sparse vectors, dense, identity, triangular, banded,
23 symmetric, hermitian and sparse matrices. Views into vectors and matrices can be constructed via ranges, slices,
24 adaptor classes and indirect arrays. The library covers the usual basic linear algebra operations on vectors and matrices: reductions like
25 different norms, addition and subtraction of vectors and matrices and multiplication with a scalar, inner and outer
26 products of vectors, matrix vector and matrix matrix products and triangular solver. The glue between containers, views
27 and expression templated operations is a mostly
<a href=
"http://www.sgi.com/tech/stl">STL
</a> conforming iterator interface.
</p>
29 <h2>Documentation
</h2>
32 <li><big><a href=
"overview.html">Overview
</a></big>
34 <li><a href=
"overview.html#rationale">Rationale
</a>
37 <li><a href=
"overview.html#functionality">Functionality
</a>
40 <li><a href=
"types_overview.html">Overview of Matrix- and Vector-Types
</a>
43 <li><a href=
"operations_overview.html">Overview of Matrix and Vector Operations
</a>
46 <li><a href=
"#further_information">Effective uBLAS and further information
</a>
49 <li><a href=
"options.html">Macros and Preprocessor Options
</a>
54 <li><a href=
"vector.html">Vector
</a>
56 <li><a href=
"vector.html#vector">Vector
</a>
59 <li><a href=
"vector.html#unit_vector">Unit Vector
</a>
62 <li><a href=
"vector.html#zero_vector">Zero Vector
</a>
65 <li><a href=
"vector.html#scalar_vector">Scalar Vector
</a>
70 <li><a href=
"vector_sparse.html">Sparse Vector
</a>
72 <li><a href=
"vector_sparse.html#mapped_vector">Mapped Vector
</a>
75 <li><a href=
"vector_sparse.html#compressed_vector">Compressed Vector
</a>
78 <li><a href=
"vector_sparse.html#coordinate_vector">Coordinate Vector
</a>
83 <li><a href=
"vector_proxy.html">Vector Proxies
</a>
85 <li><a href=
"vector_proxy.html#vector_range">Vector Range
</a>
88 <li><a href=
"vector_proxy.html#vector_slice">Vector Slice
</a>
93 <li><a href=
"vector_expression.html">Vector Expressions
</a>
95 <li><a href=
"vector_expression.html#vector_expression">Vector Expression
</a>
98 <li><a href=
"vector_expression.html#vector_references">Vector References
</a>
101 <li><a href=
"vector_expression.html#vector_operations">Vector Operations
</a>
104 <li><a href=
"vector_expression.html#vector_reductions">Vector Reductions
</a>
109 <li><a href=
"matrix.html">Matrix
</a>
111 <li><a href=
"matrix.html#matrix">Matrix
</a>
114 <li><a href=
"matrix.html#identity_matrix">Identity Matrix
</a>
117 <li><a href=
"matrix.html#zero_matrix">Zero Matrix
</a>
120 <li><a href=
"matrix.html#scalar_matrix">Scalar Matrix
</a>
125 <li><a href=
"triangular.html">Triangular Matrix
</a>
127 <li><a href=
"triangular.html#triangular_matrix">Triangular Matrix
</a>
130 <li><a href=
"triangular.html#triangular_adaptor">Triangular Adaptor
</a>
135 <li><a href=
"symmetric.html">Symmetric Matrix
</a>
137 <li><a href=
"symmetric.html#symmetric_matrix">Symmetric Matrix
</a>
140 <li><a href=
"symmetric.html#symmetric_adaptor">Symmetric Adaptor
</a>
145 <li><a href=
"hermitian.html">Hermitian Matrix
</a>
147 <li><a href=
"hermitian.html#hermitian_matrix">Hermitian Matrix
</a>
150 <li><a href=
"hermitian.html#hermitian_adaptor">Hermitian Adaptor
</a>
155 <li><a href=
"banded.html">Banded Matrix
</a>
157 <li><a href=
"banded.html#banded_matrix">Banded Matrix
</a>
160 <li><a href=
"banded.html#banded_adaptor">Banded Adaptor
</a>
165 <li><a href=
"matrix_sparse.html">Sparse Matrix
</a>
167 <li><a href=
"matrix_sparse.html#mapped_matrix">Mapped Matrix
</a>
170 <li><a href=
"matrix_sparse.html#compressed_matrix">Compressed Matrix
</a>
173 <li><a href=
"matrix_sparse.html#coordinate_matrix">Coordinate Matrix
</a>
178 <li><a href=
"matrix_proxy.html">Matrix Proxies
</a>
180 <li><a href=
"matrix_proxy.html#matrix_row">Matrix Row
</a>
183 <li><a href=
"matrix_proxy.html#matrix_column">Matrix Column
</a>
186 <li><a href=
"matrix_proxy.html#vector_range">Vector Range
</a>
189 <li><a href=
"matrix_proxy.html#vector_slice">Vector Slice
</a>
192 <li><a href=
"matrix_proxy.html#matrix_range">Matrix Range
</a>
195 <li><a href=
"matrix_proxy.html#matrix_slice">Matrix Slice
</a>
200 <li><a href=
"matrix_expression.html">Matrix Expressions
</a>
202 <li><a href=
"matrix_expression.html#matrix_expression">Matrix Expression
</a>
205 <li><a href=
"matrix_expression.html#matrix_references">Matrix References
</a>
208 <li><a href=
"matrix_expression.html#matrix_operations">Matrix Operations
</a>
211 <li><a href=
"matrix_expression.html#matrix_vector_operations">Matrix Vector Operations
</a>
214 <li><a href=
"matrix_expression.html#matrix_matrix_operations">Matrix Matrix Operations
</a>
219 <li>Storage and special containers
222 <li><a href=
"unbounded_array.html">Unbounded Array
</a>
225 <li><a href=
"bounded_array.html">Bounded Array
</a>
228 <li><a href=
"range.html#range">Range
</a>
231 <li><a href=
"range.html#slice">Slice
</a>
235 <li><a href=
"storage_sparse.html">Sparse Storage
</a>
237 <li><a href=
"storage_sparse.html#map_std">Default Standard Map
</a>
240 <li><a href=
"storage_sparse.html#map_array">Map Array
</a>
245 <li>Operations
& Functions
248 <li><a href=
"products.html">Special Products
</a>
251 <li><a href=
"blas.html">BLAS
</a>
255 <li>uBLAS Concept definitions
258 <li><a href=
"container_concept.html">Container Concepts
</a>
260 <li><a href=
"container_concept.html#vector">Vector
</a>
263 <li><a href=
"container_concept.html#matrix">Matrix
</a>
268 <li><a href=
"expression_concept.html">Expression Concepts
</a>
270 <li><a href=
"expression_concept.html#scalar_expression">Scalar Expression
</a>
273 <li><a href=
"expression_concept.html#vector_expression">Vector Expression
</a>
276 <li><a href=
"expression_concept.html#matrix_expression">Matrix Expression
</a>
281 <li><a href=
"storage_concept.html">Storage Concept
</a>
284 <li><a href=
"iterator_concept.html">Iterator Concepts
</a>
286 <li><a href=
"iterator_concept.html#indexed_bidirectional_iterator">Indexed Bidirectional Iterator
</a>
289 <li><a href=
"iterator_concept.html#indexed_random_access_iterator">Indexed Random Access Iterator
</a>
292 <li><a href=
"iterator_concept.html#indexed_bidirectional_cr_iterator">Indexed Bidirectional Column/Row Iterator
</a>
295 <li><a href=
"iterator_concept.html#indexed_random_access_cr_iterator">Indexed Random Access Column/Row Iterator
</a>
302 <a name=
"further_information" id=
"further_information"></a>
303 <h2>Known limitations:
</h2>
306 <li>The implementation assumes a linear memory address model.
</li>
308 <li>Tuning was focussed on dense matrices.
</li>
311 <h2>Further Information
</h2>
313 <h3>Project Location and Download
</h3>
315 <p>The latest stable release of uBLAS is part of the
<a href=
"http://www.boost.org">Boost
</a> libraries.
</p>
317 <h3>Documentation and Discussion
</h3>
319 <p>Visit the
<a href=
"http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Effective_UBLAS">Effective
320 uBLAS
</a> wiki for up to date information and contributions.
</p>
322 <p>There is also an active uBLAS
<a href=
"http://lists.boost.org/">mailing list
</a> where uBLAS specific user and
323 development questions are answered.
</p>
325 <h3>uBLAS and Boost Project
</h3>
327 <p>There is also an active uBLAS
<a href=
"http://lists.boost.org/">mailing list
</a> where uBLAS specific from the
328 latest uBLAS project code. You can
<a href=
"http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost">view
</a> the Boost
329 CVS archive directly. You will find the library
<a href=
330 "http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost/boost/boost/numeric/ublas/">here
</a>. Documentation and test
331 programs reside
<a href=
"http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/boost/boost/libs/numeric/ublas/">here
</a>.
</p>
333 <h2>Authors and Credits
</h2>
335 <p>uBLAS initially was written by Joerg Walter and Mathias Koch. We would like to thank all, which supported and
336 contributed to the development of this library: David Abrahams, Ed Brey, Fernando Cacciola, Juan Jose Gomez Cadenas,
337 Beman Dawes, Matt Davies, Bob Fletcher, Kresimir Fresl, Joachim Kessel, Patrick Kowalzick, Toon Knapen, Hendrik Kueck,
338 John Maddock, Jens Maurer, Alexei Novakov, Gary Powell, Joachim Pyras, Peter Schmitteckert, Jeremy Siek, Markus Steffl,
339 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>
341 This library is currently maintained by
<a=
"mailto:david.bellot@gmail.com">David Bellot
</a>.
342 <h2>Frequently Asked Questions
</h2>
344 <p>Q: Should I use uBLAS for new projects?
<br/>
345 A: At the time of writing (
09/
2012) there are a lot of good matrix libraries available, e.g.,
346 <a href=
"http://www.simunova.com" target=
"_blank">MTL4
</a>,
347 <a href=
"http://arma.sourceforge.net" target=
"_blank">armadillo
</a>,
348 <a href=
"http://eigen.tuxfamily.org" target=
"_blank">eigen
</a>. uBLAS offers a stable, well tested set of vector and
349 matrix classes, the typical operations for linear algebra and solvers for triangular systems of equations. uBLAS offers
350 dense, structured and sparse matrices - all using similar interfaces. And finally uBLAS offers good (but not outstanding)
351 performance. On the other side, the last major improvement of uBLAS was in
2008 and no significant change was committed
352 since
2009. So one should ask himself some questions to aid the decision:
<i>Availability?
</i> uBLAS is part of boost
353 and thus available in many environments.
<i>Easy to use?
</i> uBLAS is easy to use for simple things, but needs decent
354 C++ knowledge when you leave the path.
<i>Performance?
</i> There are faster alternatives.
<i>Cutting edge?
</i> uBLAS
355 is more than
10 years old and missed all new stuff from C++
11.
</p>
357 <p>Q: I'm running the uBLAS dense vector and matrix benchmarks. Why do I see a significant performance difference
358 between the native C and library implementations?
<br />
359 A: uBLAS distinguishes debug mode (size and type conformance checks enabled, expression templates disabled) and release
360 mode (size and type conformance checks disabled, expression templates enabled). Please check, if the preprocessor
361 symbol
<code>NDEBUG
</code> of
<code>cassert
</code> is defined.
<code>NDEBUG
</code> enables release mode, which in turn
362 uses expression templates. You can optionally define
<code>BOOST_UBLAS_NDEBUG
</code> to disable all bounds, structure
363 and similar checks of uBLAS.
</p>
365 <p>Q: I've written some uBLAS tests, which try to incorrectly assign different matrix types or overrun vector and
366 matrix dimensions. Why don't I get a compile time or runtime diagnostic?
<br />
367 A: uBLAS distinguishes debug mode (size and type conformance checks enabled, expression templates disabled) and release
368 mode (size and type conformance checks disabled, expression templates enabled). Please check, if the preprocessor
369 symbol
<code>NDEBUG
</code> of
<code>cassert
</code> is defined.
<code>NDEBUG
</code> disables debug mode, which is needed
370 to get size and type conformance checks.
</p>
372 <p>Q: I've written some uBLAS benchmarks to measure the performance of matrix chain multiplications like
<code>prod (A,
373 prod (B, C))
</code> and see a significant performance penalty due to the use of expression templates. How can I disable
374 expression templates?
<br />
375 A: You do not need to disable expression templates. Please try reintroducing temporaries using either
<code>prod
376 (A,
</code> <code><em>matrix_type
</em></code> <code>(prod (B, C)))
</code> or
<code>prod (A,
377 prod
<</code><code><em>matrix_type
</em></code> <code>> (B, C))
</code>.
</p>
381 <p>Copyright (
©)
2000-
2011 Joerg Walter, Mathias Koch, Gunter Winkler, David Bellot
<br />
382 Use, modification and distribution are subject to the Boost Software License, Version
1.0. (See accompanying file
383 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>
385 <script type=
"text/javascript">