You are viewing the develop version of this library.
The master and develop pages are shown here to provide access to the newest in-development in-progress documentation. See the "Documentation" link on this page.
Other aspects of the page will reflect the previous official version, or not be available until the next release.
Boost.uBlas is a header-only library and part of the Boost C++ libraries. It provides a set of basic linear and multilinear algebra operations with tensors, matrices and vectors. uBLAS is documented at boost.org or in docs. Simple examples of the tensor extension is provided by the wiki page.
#include <boost/numeric/ublas/tensor.hpp>
#include <iostream>
int main()
{
using namespace boost::numeric::ublas::index;
using tensor = boost::numeric::ublas::tensor_dynamic<float>;
auto ones = boost::numeric::ublas::ones<float>{};
tensor A = ones(3,4,5);
tensor B = ones(4,6,3,2);
tensor C = 2*ones(5,6,2) + A(_i,_j,_k)*B(_j,_l,_i,_m) + 5;
// Matlab Compatible Formatted Output
std::cout << "C=" << C << ";" << std::endl;
}
[ublas] tag at the beginning of the subject line or Stackoverflow using boost-ublas or ublas tags| Name | Purpose |
|---|---|
doc |
documentation |
examples |
example files |
include |
headers |
test |
unit tests |
benchmarks |
timing and benchmarking |
<h1>Boost Linear and Multilinear Algebra Library</h1> <p><a href="https://en.wikipedia.org/wiki/C%2B%2B#Standardization"><img src="https://img.shields.io/badge/C%2B%2B-20-blue.svg" alt="Language" /></a> <a href="https://opensource.org/licenses/BSL-1.0"><img src="https://img.shields.io/badge/license-BSL-blue.svg" alt="License" /></a> <a href="https://www.boost.org/doc/libs/1_69_0/libs/numeric/ublas/doc/index.html"><img src="https://img.shields.io/badge/ublas-documentation-blue.svg" alt="Documentation" /></a> <a href="https://github.com/boostorg/ublas/wiki"><img src="https://img.shields.io/badge/ublas-wiki-blue.svg" alt="Wiki" /></a> <a href="https://lists.boost.org/mailman/listinfo.cgi/ublas"><img src="https://img.shields.io/badge/ublas-mailing%20list-4eb899.svg" alt="Mailing List" /></a> <a href="https://github.com/boostorg/ublas/discussions"><img src="https://img.shields.io/badge/ublas-discussions-blue" alt="Discussions" /></a> <a href="https://gitter.im/boostorg/ublas"><img src="https://img.shields.io/badge/ublas-chat%20on%20gitter-4eb899.svg" alt="Gitter" /></a> <a href="https://github.com/boostorg/ublas/wiki/Code-of-Conduct"><img src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg" alt="Contributor Covenant" /></a></p> <p><a href="https://github.com/boostorg/ublas/actions/workflows/windows.yml"><img src="https://github.com/boostorg/ublas/actions/workflows/windows.yml/badge.svg" alt="Windows" /></a> <a href="https://github.com/boostorg/ublas/actions/workflows/linux.yml"><img src="https://github.com/boostorg/ublas/actions/workflows/linux.yml/badge.svg" alt="Linux" /></a> <a href="https://github.com/boostorg/ublas/actions/workflows/apple.yml"><img src="https://github.com/boostorg/ublas/actions/workflows/apple.yml/badge.svg" alt="Apple MacOS" /></a> <a href="https://github.com/boostorg/ublas/actions/workflows/sanitizer.yml"><img src="https://github.com/boostorg/ublas/actions/workflows/sanitizer.yml/badge.svg" alt="Clang Sanitizer" /></a> <a href="https://github.com/boostorg/ublas/actions/workflows/clangtidy.yml"><img src="https://github.com/boostorg/ublas/actions/workflows/clangtidy.yml/badge.svg" alt="Clang Tidy" /></a> <a href="https://codecov.io/gh/boostorg/ublas/branch/master"><img src="https://codecov.io/gh/boostorg/ublas/branch/master/graph/badge.svg" alt="Codecov" /></a></p> <p>Boost.uBlas is a header-only library and part of the <a href="http://github.com/boostorg">Boost C++ libraries</a>. It provides a set of basic linear and multilinear algebra operations with tensors, matrices and vectors. uBLAS is documented at <a href="https://www.boost.org/doc/libs/1_69_0/libs/numeric/ublas/doc/index.html">boost.org</a> or in <a href="https://github.com/BoostGSoC21/ublas/blob/develop/doc/ublas.adoc">docs</a>. Simple examples of the tensor extension is provided by the <a href="https://github.com/boostorg/ublas/wiki/Tensor">wiki page</a>.</p> <h2>Simple Example</h2> <pre class="highlightjs highlight"><code class="language-cpp hljs">#include <boost/numeric/ublas/tensor.hpp> #include <iostream> int main() { using namespace boost::numeric::ublas::index; using tensor = boost::numeric::ublas::tensor_dynamic<float>; auto ones = boost::numeric::ublas::ones<float>{}; tensor A = ones(3,4,5); tensor B = ones(4,6,3,2); tensor C = 2*ones(5,6,2) + A(_i,_j,_k)*B(_j,_l,_i,_m) + 5; // Matlab Compatible Formatted Output std::cout << "C=" << C << ";" << std::endl; } </code></pre> <h2>Requirements</h2> <ul> <li>Boost.uBlas requires a C++20 compatible compiler <ul> <li>gcc version >= 10.x.x</li> <li>clang version >= 10.x.x</li> <li>msvc version >= 14.28</li> </ul> </li> <li>Unit-tests require Boost.Test</li> </ul> <h2>Discussions and Questions</h2> <ul> <li>Be sure to have read our <a href="https://github.com/boostorg/ublas/wiki/Code-of-Conduct">code of conduct</a> and Boost's <a href="http://www.boost.org/community/policy.html">discussion policy</a></li> <li>Contributors and maintainers mainly use <a href="https://github.com/boostorg/ublas/discussions">Discussions</a> (previously <a href="https://gitter.im/boostorg/ublas">Gitter</a>) to discuss library design or governance topics.</li> <li>Users of the library can choose between the following platforms preferably <a href="https://gitter.im/boostorg/ublas">Gitter</a>, the <a href="https://lists.boost.org/mailman/listinfo.cgi/ublas">Boost developers mailing list</a> using the <code>[ublas]</code> tag at the beginning of the subject line or <a href="http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-ublas">Stackoverflow</a> using <code>boost-ublas</code> or <code>ublas</code> tags</li> <li>Contact the maintainers <a href="https://gitter.im/bassoy">Cem</a>, <a href="https://gitter.im/yimyom">David</a> or <a href="https://gitter.im/stefanseefeld">Stefan</a> if you have suggestions</li> </ul> <h2>Contribution</h2> <ul> <li>Be sure that you have read our <a href="https://github.com/boostorg/ublas/wiki/Guidelines-for-Contribution">contribution guidelines</a> and our <a href="https://github.com/boostorg/ublas/wiki/Code-of-Conduct">code of conduct</a></li> <li>If you want to report a bug, create an <a href="https://github.com/boostorg/ublas/issues">issue</a></li> <li>If you want to submit a patch, create pull request against <strong>develop</strong> branch.</li> </ul> <h2>Directories</h2> <table> <thead> <tr> <th align="left">Name</th> <th align="left">Purpose</th> </tr> </thead> <tbody> <tr> <td align="left"><code>doc</code></td> <td align="left">documentation</td> </tr> <tr> <td align="left"><code>examples</code></td> <td align="left">example files</td> </tr> <tr> <td align="left"><code>include</code></td> <td align="left">headers</td> </tr> <tr> <td align="left"><code>test</code></td> <td align="left">unit tests</td> </tr> <tr> <td align="left"><code>benchmarks</code></td> <td align="left">timing and benchmarking</td> </tr> </tbody> </table>
<h1>Boost Linear and Multilinear Algebra Library</h1> <p><a href="https://en.wikipedia.org/wiki/C%2B%2B#Standardization"><img src="https://img.shields.io/badge/C%2B%2B-20-blue.svg" alt="Language" /></a> <a href="https://opensource.org/licenses/BSL-1.0"><img src="https://img.shields.io/badge/license-BSL-blue.svg" alt="License" /></a> <a href="https://www.boost.org/doc/libs/1_69_0/libs/numeric/ublas/doc/index.html"><img src="https://img.shields.io/badge/ublas-documentation-blue.svg" alt="Documentation" /></a> <a href="https://github.com/boostorg/ublas/wiki"><img src="https://img.shields.io/badge/ublas-wiki-blue.svg" alt="Wiki" /></a> <a href="https://lists.boost.org/mailman/listinfo.cgi/ublas"><img src="https://img.shields.io/badge/ublas-mailing%20list-4eb899.svg" alt="Mailing List" /></a> <a href="https://github.com/boostorg/ublas/discussions"><img src="https://img.shields.io/badge/ublas-discussions-blue" alt="Discussions" /></a> <a href="https://gitter.im/boostorg/ublas"><img src="https://img.shields.io/badge/ublas-chat%20on%20gitter-4eb899.svg" alt="Gitter" /></a> <a href="https://github.com/boostorg/ublas/wiki/Code-of-Conduct"><img src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg" alt="Contributor Covenant" /></a></p> <p><a href="https://github.com/boostorg/ublas/actions/workflows/windows.yml"><img src="https://github.com/boostorg/ublas/actions/workflows/windows.yml/badge.svg" alt="Windows" /></a> <a href="https://github.com/boostorg/ublas/actions/workflows/linux.yml"><img src="https://github.com/boostorg/ublas/actions/workflows/linux.yml/badge.svg" alt="Linux" /></a> <a href="https://github.com/boostorg/ublas/actions/workflows/apple.yml"><img src="https://github.com/boostorg/ublas/actions/workflows/apple.yml/badge.svg" alt="Apple MacOS" /></a> <a href="https://github.com/boostorg/ublas/actions/workflows/sanitizer.yml"><img src="https://github.com/boostorg/ublas/actions/workflows/sanitizer.yml/badge.svg" alt="Clang Sanitizer" /></a> <a href="https://github.com/boostorg/ublas/actions/workflows/clangtidy.yml"><img src="https://github.com/boostorg/ublas/actions/workflows/clangtidy.yml/badge.svg" alt="Clang Tidy" /></a> <a href="https://codecov.io/gh/boostorg/ublas/branch/master"><img src="https://codecov.io/gh/boostorg/ublas/branch/master/graph/badge.svg" alt="Codecov" /></a></p> <p>Boost.uBlas is a header-only library and part of the <a href="http://github.com/boostorg">Boost C++ libraries</a>. It provides a set of basic linear and multilinear algebra operations with tensors, matrices and vectors. uBLAS is documented at <a href="https://www.boost.org/doc/libs/1_69_0/libs/numeric/ublas/doc/index.html">boost.org</a> or in <a href="https://github.com/BoostGSoC21/ublas/blob/develop/doc/ublas.adoc">docs</a>. Simple examples of the tensor extension is provided by the <a href="https://github.com/boostorg/ublas/wiki/Tensor">wiki page</a>.</p> <h2>Simple Example</h2> <pre class="highlightjs highlight"><code class="language-cpp hljs">#include <boost/numeric/ublas/tensor.hpp> #include <iostream> int main() { using namespace boost::numeric::ublas::index; using tensor = boost::numeric::ublas::tensor_dynamic<float>; auto ones = boost::numeric::ublas::ones<float>{}; tensor A = ones(3,4,5); tensor B = ones(4,6,3,2); tensor C = 2*ones(5,6,2) + A(_i,_j,_k)*B(_j,_l,_i,_m) + 5; // Matlab Compatible Formatted Output std::cout << "C=" << C << ";" << std::endl; } </code></pre> <h2>Requirements</h2> <ul> <li>Boost.uBlas requires a C++20 compatible compiler <ul> <li>gcc version >= 10.x.x</li> <li>clang version >= 10.x.x</li> <li>msvc version >= 14.28</li> </ul> </li> <li>Unit-tests require Boost.Test</li> </ul> <h2>Discussions and Questions</h2> <ul> <li>Be sure to have read our <a href="https://github.com/boostorg/ublas/wiki/Code-of-Conduct">code of conduct</a> and Boost's <a href="http://www.boost.org/community/policy.html">discussion policy</a></li> <li>Contributors and maintainers mainly use <a href="https://github.com/boostorg/ublas/discussions">Discussions</a> (previously <a href="https://gitter.im/boostorg/ublas">Gitter</a>) to discuss library design or governance topics.</li> <li>Users of the library can choose between the following platforms preferably <a href="https://gitter.im/boostorg/ublas">Gitter</a>, the <a href="https://lists.boost.org/mailman/listinfo.cgi/ublas">Boost developers mailing list</a> using the <code>[ublas]</code> tag at the beginning of the subject line or <a href="http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-ublas">Stackoverflow</a> using <code>boost-ublas</code> or <code>ublas</code> tags</li> <li>Contact the maintainers <a href="https://gitter.im/bassoy">Cem</a>, <a href="https://gitter.im/yimyom">David</a> or <a href="https://gitter.im/stefanseefeld">Stefan</a> if you have suggestions</li> </ul> <h2>Contribution</h2> <ul> <li>Be sure that you have read our <a href="https://github.com/boostorg/ublas/wiki/Guidelines-for-Contribution">contribution guidelines</a> and our <a href="https://github.com/boostorg/ublas/wiki/Code-of-Conduct">code of conduct</a></li> <li>If you want to report a bug, create an <a href="https://github.com/boostorg/ublas/issues">issue</a></li> <li>If you want to submit a patch, create pull request against <strong>develop</strong> branch.</li> </ul> <h2>Directories</h2> <table> <thead> <tr> <th align="left">Name</th> <th align="left">Purpose</th> </tr> </thead> <tbody> <tr> <td align="left"><code>doc</code></td> <td align="left">documentation</td> </tr> <tr> <td align="left"><code>examples</code></td> <td align="left">example files</td> </tr> <tr> <td align="left"><code>include</code></td> <td align="left">headers</td> </tr> <tr> <td align="left"><code>test</code></td> <td align="left">unit tests</td> </tr> <tr> <td align="left"><code>benchmarks</code></td> <td align="left">timing and benchmarking</td> </tr> </tbody> </table>