uBLAS is a C++ template class library that provides BLAS level 1, 2, 3 functionality for dense, packed and sparse matrices. The design and implementation unify mathematical notation via operator overloading and efficient code generation via expression templates.
uBLAS provides templated C++ classes for dense, unit and sparse vectors, dense, identity, triangular, banded, symmetric, hermitian and sparse matrices. Views into vectors and matrices can be constructed via ranges or slices and adaptor classes. The library covers the usual basic linear algebra operations on vectors and matrices: reductions like different norms, addition and subtraction of vectors and matrices and multiplication with a scalar, inner and outer products of vectors, matrix vector and matrix matrix products and triangular solver. The glue between containers, views and expression templated operations is a mostly STL conforming iterator interface.
Dense, packed and sparse matrix classes are being tested with the CLAPACK test suite.
Known limitations:
As main development platform for uBLAS we used MSVC 6.0 with Dinkumware STL. Other compilers known to accept the library are
You can download the current stable release of the source code from here. Prerequisite is the latest stable release of the Boost libraries Configuration, Timer and optionally SmartPointer.
You can also check out the latest version via anonymous CVS. Here's how:
cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost login (password is empty) cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost checkout boost/boost/numeric/ublas cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost checkout boost/libs/numeric/ublas
If you have gzip installed on your system, you can speed up the transfer using
cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost -z9 checkout boost/boost/numeric/ublas cvs -d:pserver:anonymous@cvs.boost.sourceforge.net:/cvsroot/boost -z9 checkout boost/libs/numeric/ublas
You can also view the CVS archive. You may find the library here. Documentation and test programs reside here.
uBLAS has no dedicated mailing list. Feel free to use the mailing lists of Boost.
uBLAS initially was written by Joerg Walter and Mathias Koch. We would like to thank all, which supported the development of this library: David Abrahams, Ed Brey, Fernando Cacciola, Beman Dawes, Bob Fletcher, Kresimir Fresl, Joachim Kessel, Toon Knapen, Jens Maurer, Gary Powell, Joachim Pyras, Peter Schmitteckert, Jeremy Siek, Markus Steffl, Michael Stevens, Benedikt Weber, Martin Weiser, Marc Zimmermann and the members of Boost
Q: I'm running the uBLAS dense vector and matrix benchmarks.
Why do I see a significant performance difference between the
native C and library implementations?
A: uBLAS distinguishes debug mode (size and type conformance
checks enabled, expression templates disabled) and release mode
(size and type conformance checks disabled, expression templates
enabled). Please check, if the preprocessor symbol NDEBUG
of cassert
is defined. NDEBUG
enables
release mode, which in turn uses expression templates.
Q: I've written some uBLAS tests, which try to incorrectly
assign different matrix types or overrun vector and matrix
dimensions. Why don't I get a compile time or runtime diagnostic?
A: uBLAS distinguishes debug mode (size and type conformance
checks enabled, expression templates disabled) and release mode
(size and type conformance checks disabled, expression templates
enabled). Please check, if the preprocessor symbol NDEBUG
of cassert
is defined. NDEBUG
disables
debug mode, which is needed to get size and type conformance
checks.
Q: I've written some uBLAS benchmarks to measure the
performance of matrix chain multiplications like prod (A,
prod (B, C))
and see a significant performance penalty due
to the use of expression templates. How can I disable expression
templates?
A: You do not need to disable expression templates. Please try
reintroducing temporaries using either prod (A,
matrix_type
(prod (B, C)))
or prod (A, prod<
matrix_type
>
(B, C))
.
If you have a problem, or have found a bug, please send us a note.
Copyright (©) 2000-2002 Joerg Walter, Mathias Koch
Permission to copy, use, modify, sell and distribute this
document is granted provided this copyright notice appears in all
copies. This document is provided ``as is'' without express or
implied warranty, and with no claim as to its suitability for any
purpose.
Last revised: 8/3/2002