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"> 4<head> 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<script type="text/x-mathjax-config"> 11MathJax.Hub.Config({ 12 jax: ["input/TeX", "output/HTML-CSS"], 13 extensions: ["tex2jax.js"], 14 "HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"], scale: "80" }, 15 tex2jax: { 16 inlineMath: [ ["$", "$"], ["\\(","\\)"] ], 17 displayMath: [ ["$$","$$"], ["\\[", "\\]"] ], 18 processEscapes: true, 19 ignoreClass: "tex2jax_ignore|dno" }, 20 TeX: { noUndefined: { attributes: { mathcolor: "red", mathbackground: "#FFEEEE", mathsize: "90%" } } }, 21 messageStyle: "none" 22 }); 23</script> 24<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js"></script> 25 26<title>Boost Basic Linear Algebra</title> 27</head> 28<body> 29<h1><img src="../../../../boost.png" align="middle" alt="logo"/>Basic Linear Algebra Library</h1> 30<div class="toc" id="toc"></div> 31 32<p>uBLAS is a C++ template class library that provides <a href="http://www.netlib.org/blas">BLAS</a> level 1, 2, 3 33functionality for dense, packed and sparse matrices. The design and implementation unify mathematical notation via 34operator overloading and efficient code generation via expression templates.</p> 35 36<h2>Functionality</h2> 37 38<p>uBLAS provides templated C++ classes for dense, unit and sparse vectors, dense, identity, triangular, banded, 39symmetric, hermitian and sparse matrices. Views into vectors and matrices can be constructed via ranges, slices, 40adaptor classes and indirect arrays. The library covers the usual basic linear algebra operations on vectors and matrices: reductions like 41different norms, addition and subtraction of vectors and matrices and multiplication with a scalar, inner and outer 42products of vectors, matrix vector and matrix matrix products and triangular solver. The glue between containers, views 43and expression templated operations is a mostly <a href="http://www.sgi.com/tech/stl">STL</a> conforming iterator interface.</p> 44 45<h2>Documentation</h2> 46 47<ul> 48<li><big><a href="overview.html">Overview</a></big> 49<ul> 50<li><a href="overview.html#rationale">Rationale</a> 51</li> 52 53<li><a href="overview.html#functionality">Functionality</a> 54</li> 55 56<li><a href="types_overview.html">Overview of Tensor, Matrix- and Vector Types</a> 57</li> 58 59<li><a href="operations_overview.html">Overview of Tensor, Matrix and Vector Operations</a> 60</li> 61 62<li><a href="#further_information">Effective uBLAS and further information</a> 63</li> 64 65<li><a href="options.html">Macros and Preprocessor Options</a> 66</li> 67</ul> 68</li> 69 70<li><a href="vector.html">Vector</a> 71<ul> 72<li><a href="vector.html#vector">Vector</a> 73</li> 74 75<li><a href="vector.html#unit_vector">Unit Vector</a> 76</li> 77 78<li><a href="vector.html#zero_vector">Zero Vector</a> 79</li> 80 81<li><a href="vector.html#scalar_vector">Scalar Vector</a> 82</li> 83</ul> 84</li> 85 86<li><a href="vector_sparse.html">Sparse Vector</a> 87<ul> 88<li><a href="vector_sparse.html#mapped_vector">Mapped Vector</a> 89</li> 90 91<li><a href="vector_sparse.html#compressed_vector">Compressed Vector</a> 92</li> 93 94<li><a href="vector_sparse.html#coordinate_vector">Coordinate Vector</a> 95</li> 96</ul> 97</li> 98 99<li><a href="vector_proxy.html">Vector Proxies</a> 100<ul> 101<li><a href="vector_proxy.html#vector_range">Vector Range</a> 102</li> 103 104<li><a href="vector_proxy.html#vector_slice">Vector Slice</a> 105</li> 106</ul> 107</li> 108 109<li><a href="vector_expression.html">Vector Expressions</a> 110<ul> 111<li><a href="vector_expression.html#vector_expression">Vector Expression</a> 112</li> 113 114<li><a href="vector_expression.html#vector_references">Vector References</a> 115</li> 116 117<li><a href="vector_expression.html#vector_operations">Vector Operations</a> 118</li> 119 120<li><a href="vector_expression.html#vector_reductions">Vector Reductions</a> 121</li> 122</ul> 123</li> 124 125<li><a href="matrix.html">Matrix</a> 126<ul> 127<li><a href="matrix.html#matrix">Matrix</a> 128</li> 129 130<li><a href="matrix.html#identity_matrix">Identity Matrix</a> 131</li> 132 133<li><a href="matrix.html#zero_matrix">Zero Matrix</a> 134</li> 135 136<li><a href="matrix.html#scalar_matrix">Scalar Matrix</a> 137</li> 138</ul> 139</li> 140 141<li><a href="triangular.html">Triangular Matrix</a> 142<ul> 143<li><a href="triangular.html#triangular_matrix">Triangular Matrix</a> 144</li> 145 146<li><a href="triangular.html#triangular_adaptor">Triangular Adaptor</a> 147</li> 148</ul> 149</li> 150 151<li><a href="symmetric.html">Symmetric Matrix</a> 152<ul> 153<li><a href="symmetric.html#symmetric_matrix">Symmetric Matrix</a> 154</li> 155 156<li><a href="symmetric.html#symmetric_adaptor">Symmetric Adaptor</a> 157</li> 158</ul> 159</li> 160 161<li><a href="hermitian.html">Hermitian Matrix</a> 162<ul> 163<li><a href="hermitian.html#hermitian_matrix">Hermitian Matrix</a> 164</li> 165 166<li><a href="hermitian.html#hermitian_adaptor">Hermitian Adaptor</a> 167</li> 168</ul> 169</li> 170 171<li><a href="banded.html">Banded Matrix</a> 172<ul> 173<li><a href="banded.html#banded_matrix">Banded Matrix</a> 174</li> 175 176<li><a href="banded.html#banded_adaptor">Banded Adaptor</a> 177</li> 178</ul> 179</li> 180 181<li><a href="matrix_sparse.html">Sparse Matrix</a> 182<ul> 183<li><a href="matrix_sparse.html#mapped_matrix">Mapped Matrix</a> 184</li> 185 186<li><a href="matrix_sparse.html#compressed_matrix">Compressed Matrix</a> 187</li> 188 189<li><a href="matrix_sparse.html#coordinate_matrix">Coordinate Matrix</a> 190</li> 191</ul> 192</li> 193 194<li><a href="matrix_proxy.html">Matrix Proxies</a> 195<ul> 196<li><a href="matrix_proxy.html#matrix_row">Matrix Row</a> 197</li> 198 199<li><a href="matrix_proxy.html#matrix_column">Matrix Column</a> 200</li> 201 202<li><a href="matrix_proxy.html#vector_range">Vector Range</a> 203</li> 204 205<li><a href="matrix_proxy.html#vector_slice">Vector Slice</a> 206</li> 207 208<li><a href="matrix_proxy.html#matrix_range">Matrix Range</a> 209</li> 210 211<li><a href="matrix_proxy.html#matrix_slice">Matrix Slice</a> 212</li> 213</ul> 214</li> 215 216<li><a href="matrix_expression.html">Matrix Expressions</a> 217<ul> 218<li><a href="matrix_expression.html#matrix_expression">Matrix Expression</a> 219</li> 220 221<li><a href="matrix_expression.html#matrix_references">Matrix References</a> 222</li> 223 224<li><a href="matrix_expression.html#matrix_operations">Matrix Operations</a> 225</li> 226 227<li><a href="matrix_expression.html#matrix_vector_operations">Matrix Vector Operations</a> 228</li> 229 230<li><a href="matrix_expression.html#matrix_matrix_operations">Matrix Matrix Operations</a> 231</li> 232</ul> 233</li> 234 235 236<li><a href="tensor.html">Tensor</a> 237<ul> 238<li><a href="tensor.html#tensor">Tensor</a> </li> 239</ul> 240</li> 241 242<li><a href="tensor/tensor_expression.html">Tensor Expressions</a> 243 244<ul> 245<li><a href="tensor/tensor_expression.html#tensor_expression">Tensor Expression</a> 246</li> 247 248<li><a href="tensor/tensor_expression.html#binary_tensor_expression">Binary Tensor Expression</a> 249</li> 250 251<li><a href="tensor/tensor_expression.html#unary_tensor_expression">Unary Tensor Expression</a> 252</li> 253</ul> 254</li> 255 256 257 258<li>Storage and special containers 259 260<ul> 261<li><a href="unbounded_array.html">Unbounded Array</a> 262</li> 263 264<li><a href="bounded_array.html">Bounded Array</a> 265</li> 266 267<li><a href="range.html#range">Range</a> 268</li> 269 270<li><a href="range.html#slice">Slice</a> 271</li> 272 273<li><a href="tensor/extents.html#extents">Extents</a> 274</li> 275 276<li><a href="tensor/strides.html#strides">Strides</a> 277</li> 278 279</ul></li> 280 281<li><a href="storage_sparse.html">Sparse Storage</a> 282<ul> 283<li><a href="storage_sparse.html#map_std">Default Standard Map</a> 284</li> 285 286<li><a href="storage_sparse.html#map_array">Map Array</a> 287</li> 288</ul> 289</li> 290 291<li>Operations & Functions 292 293<ul> 294<li><a href="products.html">Special Products</a> 295</li> 296 297<li><a href="blas.html">BLAS</a> 298</li> 299</ul></li> 300 301<li>uBLAS Concept definitions 302 303<ul> 304<li><a href="container_concept.html">Container Concepts</a> 305<ul> 306<li><a href="container_concept.html#vector">Vector</a> 307</li> 308 309<li><a href="container_concept.html#matrix">Matrix</a> 310</li> 311 312<li><a href="container_concept.html#tensor">Tensor</a> 313</li> 314 315</ul> 316</li> 317 318<li><a href="expression_concept.html">Expression Concepts</a> 319<ul> 320<li><a href="expression_concept.html#scalar_expression">Scalar Expression</a> 321</li> 322 323<li><a href="expression_concept.html#vector_expression">Vector Expression</a> 324</li> 325 326<li><a href="expression_concept.html#matrix_expression">Matrix Expression</a> 327</li> 328</ul> 329</li> 330 331<li><a href="storage_concept.html">Storage Concept</a> 332</li> 333 334<li><a href="iterator_concept.html">Iterator Concepts</a> 335<ul> 336<li><a href="iterator_concept.html#indexed_bidirectional_iterator">Indexed Bidirectional Iterator</a> 337</li> 338 339<li><a href="iterator_concept.html#indexed_random_access_iterator">Indexed Random Access Iterator</a> 340</li> 341 342<li><a href="iterator_concept.html#indexed_bidirectional_cr_iterator">Indexed Bidirectional Column/Row Iterator</a> 343</li> 344 345<li><a href="iterator_concept.html#indexed_random_access_cr_iterator">Indexed Random Access Column/Row Iterator</a> 346</li> 347</ul> 348</li> 349</ul></li> 350</ul> 351 352<h2>Release notes</h2> 353Release notes can be found <a href="release_notes.html">here</a>. 354 355<a name="further_information" id="further_information"></a> 356<h2>Known limitations</h2> 357 358<ul type="disc"> 359<li>The implementation assumes a linear memory address model.</li> 360 361<li>Tuning was focussed on dense matrices.</li> 362</ul> 363 364<h2>Further Information</h2> 365 366<ul> 367 <li><a href="https://lists.boost.org/mailman/listinfo.cgi/ublas">uBLAS mailing list</a></li> 368 <li><a href="https://github.com/boostorg/ublas/wiki">uBLAS wiki</a></li> 369 <li><a href="http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Effective_UBLAS">Effective uBLAS</a> wiki</li> 370 <li><a href="https://github.com/boostorg/ublas">Code</a></li> 371</ul> 372 373<h3>Authors and Credits</h3> 374 375<p>uBLAS initially was written by Joerg Walter and Mathias Koch. We would like to thank all, which supported and 376contributed to the development of this library: David Abrahams, Ed Brey, Fernando Cacciola, Juan Jose Gomez Cadenas, 377Beman Dawes, Matt Davies, Bob Fletcher, Kresimir Fresl, Joachim Kessel, Patrick Kowalzick, Toon Knapen, Hendrik Kueck, 378John Maddock, Jens Maurer, Alexei Novakov, Gary Powell, Joachim Pyras, Peter Schmitteckert, Jeremy Siek, Markus Steffl, 379Michael 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> 380<p> 381This library is currently maintained by David Bellot and Stefan Seefeld. 382 383<h2>Frequently Asked Questions</h2> 384 385<p>Q: Should I use uBLAS for new projects?<br/> 386A: At the time of writing (09/2012) there are a lot of good matrix libraries available, e.g., 387<a href="http://www.simunova.com" target="_blank">MTL4</a>, 388<a href="http://arma.sourceforge.net" target="_blank">armadillo</a>, 389<a href="http://eigen.tuxfamily.org" target="_blank">eigen</a>. uBLAS offers a stable, well tested set of vector and 390matrix classes, the typical operations for linear algebra and solvers for triangular systems of equations. uBLAS offers 391dense, structured and sparse matrices - all using similar interfaces. And finally uBLAS offers good (but not outstanding) 392performance. On the other side, the last major improvement of uBLAS was in 2008 and no significant change was committed 393since 2009. So one should ask himself some questions to aid the decision: <i>Availability?</i> uBLAS is part of boost 394and thus available in many environments. <i>Easy to use?</i> uBLAS is easy to use for simple things, but needs decent 395C++ knowledge when you leave the path. <i>Performance?</i> There are faster alternatives. <i>Cutting edge?</i> uBLAS 396is more than 10 years old and missed all new stuff from C++11. </p> 397 398<p>Q: I'm running the uBLAS dense vector and matrix benchmarks. Why do I see a significant performance difference 399between the native C and library implementations?<br /> 400A: uBLAS distinguishes debug mode (size and type conformance checks enabled, expression templates disabled) and release 401mode (size and type conformance checks disabled, expression templates enabled). Please check, if the preprocessor 402symbol <code>NDEBUG</code> of <code>cassert</code> is defined. <code>NDEBUG</code> enables release mode, which in turn 403uses expression templates. You can optionally define <code>BOOST_UBLAS_NDEBUG</code> to disable all bounds, structure 404and similar checks of uBLAS.</p> 405 406<p>Q: I've written some uBLAS tests, which try to incorrectly assign different matrix types or overrun vector and 407matrix dimensions. Why don't I get a compile time or runtime diagnostic?<br /> 408A: uBLAS distinguishes debug mode (size and type conformance checks enabled, expression templates disabled) and release 409mode (size and type conformance checks disabled, expression templates enabled). Please check, if the preprocessor 410symbol <code>NDEBUG</code> of <code>cassert</code> is defined. <code>NDEBUG</code> disables debug mode, which is needed 411to get size and type conformance checks.</p> 412 413<p>Q: I've written some uBLAS benchmarks to measure the performance of matrix chain multiplications like <code>prod (A, 414prod (B, C))</code> and see a significant performance penalty due to the use of expression templates. How can I disable 415expression templates?<br /> 416A: You do not need to disable expression templates. Please try reintroducing temporaries using either <code>prod 417(A,</code> <code><em>matrix_type</em></code> <code>(prod (B, C)))</code> or <code>prod (A, 418prod<</code><code><em>matrix_type</em></code> <code>> (B, C))</code>.</p> 419 420<hr /> 421 422<p>Copyright (©) 2000-2011 Joerg Walter, Mathias Koch, Gunter Winkler, David Bellot<br /> 423Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file 424LICENSE_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> 425).</p> 426<script type="text/javascript"> 427(function($) { 428 $('#toc').toc(); 429})(jQuery); 430</script> 431</body> 432</html> 433