index.html 14 KB

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