Blaze is an open-source, high-performance C++ math library for dense and sparse arithmetic. With its state-of-the-art Smart Expression Template implementation Blaze combines the elegance and ease of use of a domain-specific language with HPC-grade performance, making it one of the most intuitive and fastest C++ math libraries available.
The Blaze library offers ...
- ... high performance through the integration of BLAS libraries and manually tuned HPC math kernels
- ... vectorization by SSE, SSE2, SSE3, SSSE3, SSE4, AVX, AVX2, AVX-512, FMA, and SVML
- ... parallel execution by OpenMP, C++11 threads and Boost threads
- ... the intuitive and easy to use API of a domain specific language
- ... unified arithmetic with dense and sparse vectors and matrices
- ... thoroughly tested matrix and vector arithmetic
- ... completely portable, high quality C++ source code
20.2.2017: We are happy to announce that there is now a port of the Blaze library for the R language available: RcppBlaze.
18.2.2017: Rejoice, Blaze 3.1 is finally online! And the waiting time was worthwhile: This new version comes with a bunch of new features. Amongst others Blaze 3.1 introduces the functionality to compute eigenvalues and eigenvectors and to perform a singular value decomposition. Most remarkable, however, are the new
decldiag() functions. Via these functions it is now possible to explicitly declare a matrix or matrix expression as either symmetric, Hermitian, lower or upper triangular, or diagonal. And this can have significant effects on the performance. Consider for instance the following example:
blaze::DynamicMatrix<double> A, B; // ... Resizing and initialization B = A * trans(A); // The result of the matrix multiplication is symmetric, but a // full matrix multiplication is performed B = declsym( A * trans(A) ); // Declare the result of the matrix multiplication as symmetric // i.e. perform an optimized matrix multiplication
In this example, the
declsym() function unlocks the potential to perform an optimized matrix multiplication, exploiting the compile time information that the result of the multiplication will be a symmetric matrix. Especially large matrix multiplications can benefit tremendously.
24.8.2016: Exactly four years after the release of Blaze 1.0 we are very proud to release Blaze 3.0! For four years Blaze has been supporting C++98, and with that essentially every possible compiler and system. Also, within these four years we have managed to never introduce a breaking change in the released interface of Blaze. However, we believe it is time to upgrade to the new capabilities of the C++ standard. Now, for the first time we introduce a breaking change to the Blaze library by committing to C++14.
Our new release comes with a huge variety of new features. Blaze 3.0 provides support for fused multiply-add (FMA), the Intel SVML, and improved and extended support for AVX-512. Also, it introduces custom operations via the
forEach() function. With this comes a huge variety of new componentwise operations:
erfc(). Last but not least it introduces vector-vector divisions.
Along with the upgrade to C++14, Blaze 3.0 implements several additional, smaller changes to the interface: First, the direct initialization constructors for
StaticMatrix have been removed. Instead, it is now possible to use initializer lists for the initialization of or the assignment to all dense vectors and matrices. Second, the
Sparse prefixes of all views have been removed, which for instance means that
SparseSubvector have been merged into the
Subvector class template. And third, the
byDefault inversion flag has been removed.
Wiki: Table of Contents
- Configuration and Installation
- Getting Started
- Arithmetic Operations
- Custom Operations
- Shared-Memory Parallelization
- BLAS Functions
- LAPACK Functions
- Configuration Files
- Block Vectors and Matrices
- Custom Data Types
- Error Reporting Customization
- Intra-Statement Optimization
- Blazemark: The Blaze Benchmark Suite
- Benchmarks/Performance Results
The Blaze library is licensed under the New (Revised) BSD license. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the names of the Blaze development group nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Blaze supports the C++14 standard and is compatible with a wide range of C++ compilers. In fact, Blaze is constantly tested with the GNU compiler collection (version 4.9 through 6.3), the Intel C++ compiler (16.0), the Clang compiler (version 3.7 through 4.0), and Visual C++ 2015 (Win64 only). Other compilers are not explicitly tested, but might work with a high probability.
If you are looking for a C++98 compatible math library you might consider using an older release of Blaze. Until the release 2.6 Blaze was written in C++-98 and constantly tested with the GNU compiler collection (version 4.5 through 5.0), the Intel C++ compiler (12.1, 13.1, 14.0, 15.0), the Clang compiler (version 3.4 through 3.7), and Visual C++ 2010, 2012, 2013, and 2015 (Win64 only).
- K. Iglberger, G. Hager, J. Treibig, and U. Rüde: Expression Templates Revisited: A Performance Analysis of Current Methodologies (Download). SIAM Journal on Scientific Computing, 34(2): C42--C69, 2012
- K. Iglberger, G. Hager, J. Treibig, and U. Rüde: High Performance Smart Expression Template Math Libraries (Download). Proceedings of the 2nd International Workshop on New Algorithms and Programming Models for the Manycore Era (APMM 2012) at HPCS 2012
Klaus Iglberger -- Project initiator and main developer
Georg Hager -- Performance analysis and optimization
Christian Godenschwager -- Visual Studio 2010/2012/2013/2015 bug fixes and testing
Tobias Scharpff -- Sparse matrix multiplication algorithms
byzhang -- Bug fixes
Emerson Ferreira -- Bug fixes
Fabien Péan -- CMake support
Denis Demidov -- Export CMake package configuration