Brian Silverman | dc6866b | 2018-08-05 00:18:23 -0700 | [diff] [blame^] | 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 | <title>Boost Basic Linear Algebra</title> |
| 11 | </head> |
| 12 | <body> |
| 13 | <h1><img src="../../../../boost.png" align="middle" alt="logo"/>Basic Linear Algebra Library</h1> |
| 14 | <div class="toc" id="toc"></div> |
| 15 | |
| 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> |
| 19 | |
| 20 | <h2>Functionality</h2> |
| 21 | |
| 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> |
| 28 | |
| 29 | <h2>Documentation</h2> |
| 30 | |
| 31 | <ul> |
| 32 | <li><big><a href="overview.html">Overview</a></big> |
| 33 | <ul> |
| 34 | <li><a href="overview.html#rationale">Rationale</a> |
| 35 | </li> |
| 36 | |
| 37 | <li><a href="overview.html#functionality">Functionality</a> |
| 38 | </li> |
| 39 | |
| 40 | <li><a href="types_overview.html">Overview of Matrix- and Vector-Types</a> |
| 41 | </li> |
| 42 | |
| 43 | <li><a href="operations_overview.html">Overview of Matrix and Vector Operations</a> |
| 44 | </li> |
| 45 | |
| 46 | <li><a href="#further_information">Effective uBLAS and further information</a> |
| 47 | </li> |
| 48 | |
| 49 | <li><a href="options.html">Macros and Preprocessor Options</a> |
| 50 | </li> |
| 51 | </ul> |
| 52 | </li> |
| 53 | |
| 54 | <li><a href="vector.html">Vector</a> |
| 55 | <ul> |
| 56 | <li><a href="vector.html#vector">Vector</a> |
| 57 | </li> |
| 58 | |
| 59 | <li><a href="vector.html#unit_vector">Unit Vector</a> |
| 60 | </li> |
| 61 | |
| 62 | <li><a href="vector.html#zero_vector">Zero Vector</a> |
| 63 | </li> |
| 64 | |
| 65 | <li><a href="vector.html#scalar_vector">Scalar Vector</a> |
| 66 | </li> |
| 67 | </ul> |
| 68 | </li> |
| 69 | |
| 70 | <li><a href="vector_sparse.html">Sparse Vector</a> |
| 71 | <ul> |
| 72 | <li><a href="vector_sparse.html#mapped_vector">Mapped Vector</a> |
| 73 | </li> |
| 74 | |
| 75 | <li><a href="vector_sparse.html#compressed_vector">Compressed Vector</a> |
| 76 | </li> |
| 77 | |
| 78 | <li><a href="vector_sparse.html#coordinate_vector">Coordinate Vector</a> |
| 79 | </li> |
| 80 | </ul> |
| 81 | </li> |
| 82 | |
| 83 | <li><a href="vector_proxy.html">Vector Proxies</a> |
| 84 | <ul> |
| 85 | <li><a href="vector_proxy.html#vector_range">Vector Range</a> |
| 86 | </li> |
| 87 | |
| 88 | <li><a href="vector_proxy.html#vector_slice">Vector Slice</a> |
| 89 | </li> |
| 90 | </ul> |
| 91 | </li> |
| 92 | |
| 93 | <li><a href="vector_expression.html">Vector Expressions</a> |
| 94 | <ul> |
| 95 | <li><a href="vector_expression.html#vector_expression">Vector Expression</a> |
| 96 | </li> |
| 97 | |
| 98 | <li><a href="vector_expression.html#vector_references">Vector References</a> |
| 99 | </li> |
| 100 | |
| 101 | <li><a href="vector_expression.html#vector_operations">Vector Operations</a> |
| 102 | </li> |
| 103 | |
| 104 | <li><a href="vector_expression.html#vector_reductions">Vector Reductions</a> |
| 105 | </li> |
| 106 | </ul> |
| 107 | </li> |
| 108 | |
| 109 | <li><a href="matrix.html">Matrix</a> |
| 110 | <ul> |
| 111 | <li><a href="matrix.html#matrix">Matrix</a> |
| 112 | </li> |
| 113 | |
| 114 | <li><a href="matrix.html#identity_matrix">Identity Matrix</a> |
| 115 | </li> |
| 116 | |
| 117 | <li><a href="matrix.html#zero_matrix">Zero Matrix</a> |
| 118 | </li> |
| 119 | |
| 120 | <li><a href="matrix.html#scalar_matrix">Scalar Matrix</a> |
| 121 | </li> |
| 122 | </ul> |
| 123 | </li> |
| 124 | |
| 125 | <li><a href="triangular.html">Triangular Matrix</a> |
| 126 | <ul> |
| 127 | <li><a href="triangular.html#triangular_matrix">Triangular Matrix</a> |
| 128 | </li> |
| 129 | |
| 130 | <li><a href="triangular.html#triangular_adaptor">Triangular Adaptor</a> |
| 131 | </li> |
| 132 | </ul> |
| 133 | </li> |
| 134 | |
| 135 | <li><a href="symmetric.html">Symmetric Matrix</a> |
| 136 | <ul> |
| 137 | <li><a href="symmetric.html#symmetric_matrix">Symmetric Matrix</a> |
| 138 | </li> |
| 139 | |
| 140 | <li><a href="symmetric.html#symmetric_adaptor">Symmetric Adaptor</a> |
| 141 | </li> |
| 142 | </ul> |
| 143 | </li> |
| 144 | |
| 145 | <li><a href="hermitian.html">Hermitian Matrix</a> |
| 146 | <ul> |
| 147 | <li><a href="hermitian.html#hermitian_matrix">Hermitian Matrix</a> |
| 148 | </li> |
| 149 | |
| 150 | <li><a href="hermitian.html#hermitian_adaptor">Hermitian Adaptor</a> |
| 151 | </li> |
| 152 | </ul> |
| 153 | </li> |
| 154 | |
| 155 | <li><a href="banded.html">Banded Matrix</a> |
| 156 | <ul> |
| 157 | <li><a href="banded.html#banded_matrix">Banded Matrix</a> |
| 158 | </li> |
| 159 | |
| 160 | <li><a href="banded.html#banded_adaptor">Banded Adaptor</a> |
| 161 | </li> |
| 162 | </ul> |
| 163 | </li> |
| 164 | |
| 165 | <li><a href="matrix_sparse.html">Sparse Matrix</a> |
| 166 | <ul> |
| 167 | <li><a href="matrix_sparse.html#mapped_matrix">Mapped Matrix</a> |
| 168 | </li> |
| 169 | |
| 170 | <li><a href="matrix_sparse.html#compressed_matrix">Compressed Matrix</a> |
| 171 | </li> |
| 172 | |
| 173 | <li><a href="matrix_sparse.html#coordinate_matrix">Coordinate Matrix</a> |
| 174 | </li> |
| 175 | </ul> |
| 176 | </li> |
| 177 | |
| 178 | <li><a href="matrix_proxy.html">Matrix Proxies</a> |
| 179 | <ul> |
| 180 | <li><a href="matrix_proxy.html#matrix_row">Matrix Row</a> |
| 181 | </li> |
| 182 | |
| 183 | <li><a href="matrix_proxy.html#matrix_column">Matrix Column</a> |
| 184 | </li> |
| 185 | |
| 186 | <li><a href="matrix_proxy.html#vector_range">Vector Range</a> |
| 187 | </li> |
| 188 | |
| 189 | <li><a href="matrix_proxy.html#vector_slice">Vector Slice</a> |
| 190 | </li> |
| 191 | |
| 192 | <li><a href="matrix_proxy.html#matrix_range">Matrix Range</a> |
| 193 | </li> |
| 194 | |
| 195 | <li><a href="matrix_proxy.html#matrix_slice">Matrix Slice</a> |
| 196 | </li> |
| 197 | </ul> |
| 198 | </li> |
| 199 | |
| 200 | <li><a href="matrix_expression.html">Matrix Expressions</a> |
| 201 | <ul> |
| 202 | <li><a href="matrix_expression.html#matrix_expression">Matrix Expression</a> |
| 203 | </li> |
| 204 | |
| 205 | <li><a href="matrix_expression.html#matrix_references">Matrix References</a> |
| 206 | </li> |
| 207 | |
| 208 | <li><a href="matrix_expression.html#matrix_operations">Matrix Operations</a> |
| 209 | </li> |
| 210 | |
| 211 | <li><a href="matrix_expression.html#matrix_vector_operations">Matrix Vector Operations</a> |
| 212 | </li> |
| 213 | |
| 214 | <li><a href="matrix_expression.html#matrix_matrix_operations">Matrix Matrix Operations</a> |
| 215 | </li> |
| 216 | </ul> |
| 217 | </li> |
| 218 | |
| 219 | <li>Storage and special containers |
| 220 | |
| 221 | <ul> |
| 222 | <li><a href="unbounded_array.html">Unbounded Array</a> |
| 223 | </li> |
| 224 | |
| 225 | <li><a href="bounded_array.html">Bounded Array</a> |
| 226 | </li> |
| 227 | |
| 228 | <li><a href="range.html#range">Range</a> |
| 229 | </li> |
| 230 | |
| 231 | <li><a href="range.html#slice">Slice</a> |
| 232 | </li> |
| 233 | </ul></li> |
| 234 | |
| 235 | <li><a href="storage_sparse.html">Sparse Storage</a> |
| 236 | <ul> |
| 237 | <li><a href="storage_sparse.html#map_std">Default Standard Map</a> |
| 238 | </li> |
| 239 | |
| 240 | <li><a href="storage_sparse.html#map_array">Map Array</a> |
| 241 | </li> |
| 242 | </ul> |
| 243 | </li> |
| 244 | |
| 245 | <li>Operations & Functions |
| 246 | |
| 247 | <ul> |
| 248 | <li><a href="products.html">Special Products</a> |
| 249 | </li> |
| 250 | |
| 251 | <li><a href="blas.html">BLAS</a> |
| 252 | </li> |
| 253 | </ul></li> |
| 254 | |
| 255 | <li>uBLAS Concept definitions |
| 256 | |
| 257 | <ul> |
| 258 | <li><a href="container_concept.html">Container Concepts</a> |
| 259 | <ul> |
| 260 | <li><a href="container_concept.html#vector">Vector</a> |
| 261 | </li> |
| 262 | |
| 263 | <li><a href="container_concept.html#matrix">Matrix</a> |
| 264 | </li> |
| 265 | </ul> |
| 266 | </li> |
| 267 | |
| 268 | <li><a href="expression_concept.html">Expression Concepts</a> |
| 269 | <ul> |
| 270 | <li><a href="expression_concept.html#scalar_expression">Scalar Expression</a> |
| 271 | </li> |
| 272 | |
| 273 | <li><a href="expression_concept.html#vector_expression">Vector Expression</a> |
| 274 | </li> |
| 275 | |
| 276 | <li><a href="expression_concept.html#matrix_expression">Matrix Expression</a> |
| 277 | </li> |
| 278 | </ul> |
| 279 | </li> |
| 280 | |
| 281 | <li><a href="storage_concept.html">Storage Concept</a> |
| 282 | </li> |
| 283 | |
| 284 | <li><a href="iterator_concept.html">Iterator Concepts</a> |
| 285 | <ul> |
| 286 | <li><a href="iterator_concept.html#indexed_bidirectional_iterator">Indexed Bidirectional Iterator</a> |
| 287 | </li> |
| 288 | |
| 289 | <li><a href="iterator_concept.html#indexed_random_access_iterator">Indexed Random Access Iterator</a> |
| 290 | </li> |
| 291 | |
| 292 | <li><a href="iterator_concept.html#indexed_bidirectional_cr_iterator">Indexed Bidirectional Column/Row Iterator</a> |
| 293 | </li> |
| 294 | |
| 295 | <li><a href="iterator_concept.html#indexed_random_access_cr_iterator">Indexed Random Access Column/Row Iterator</a> |
| 296 | </li> |
| 297 | </ul> |
| 298 | </li> |
| 299 | </ul></li> |
| 300 | </ul> |
| 301 | |
| 302 | <a name="further_information" id="further_information"></a> |
| 303 | <h2>Known limitations:</h2> |
| 304 | |
| 305 | <ul type="disc"> |
| 306 | <li>The implementation assumes a linear memory address model.</li> |
| 307 | |
| 308 | <li>Tuning was focussed on dense matrices.</li> |
| 309 | </ul> |
| 310 | |
| 311 | <h2>Further Information</h2> |
| 312 | |
| 313 | <h3>Project Location and Download</h3> |
| 314 | |
| 315 | <p>The latest stable release of uBLAS is part of the <a href="http://www.boost.org">Boost</a> libraries.</p> |
| 316 | |
| 317 | <h3>Documentation and Discussion</h3> |
| 318 | |
| 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> |
| 321 | |
| 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> |
| 324 | |
| 325 | <h3>uBLAS and Boost Project</h3> |
| 326 | |
| 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> |
| 332 | |
| 333 | <h2>Authors and Credits</h2> |
| 334 | |
| 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> |
| 340 | <p> |
| 341 | This library is currently maintained by <a="mailto:david.bellot@gmail.com">David Bellot</a>. |
| 342 | <h2>Frequently Asked Questions</h2> |
| 343 | |
| 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> |
| 356 | |
| 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> |
| 364 | |
| 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> |
| 371 | |
| 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> |
| 378 | |
| 379 | <hr /> |
| 380 | |
| 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> |
| 384 | ).</p> |
| 385 | <script type="text/javascript"> |
| 386 | (function($) { |
| 387 | $('#toc').toc(); |
| 388 | })(jQuery); |
| 389 | </script> |
| 390 | </body> |
| 391 | </html> |