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, SVML and SLEEF
- ... parallel execution by OpenMP, HPX, 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
Get an impression of the clear but powerful syntax of Blaze in the Getting Started tutorial and of the impressive performance in the Benchmarks section.
Older releases of Blaze can be found in the downloads section or in our [release archive](https://bitbucket.org/blaze-lib/blaze/wiki/Release Archive).
Blaze CUDA: Add CUDA capabilities to the Blaze library (Jules Pénuchot)
blaze_tensor: An implementation of 3D tensors for the Blaze library (Stellar Group)
BlazeIterative: A collection of iterative solvers (CG, BiCGSTAB, ...) for the Blaze library (Tyler Olsen)
RcppBlaze: A Blaze port for the R language (ChingChuan Chen)
15.8.2020: We are very happy to announce the release of Blaze 3.8. Again, we have extended the library with a number of amazing new features:
- Introduction of the
isinf()
andisfinite()
functions - Introduction of groups/tags for vectors and matrices
- Introduction of the
repeat()
function for vectors and matrices - Introduction of allocators for
DynamicVector
andDynamicMatrix
- Extended support for custom data types
We hope that you enjoy this new release!
23.2.2020: Today we are very proud to release Blaze 3.7. This release is packed with a long list of new features and improvements:
- Introduction of vector generators and matrix generators
- Introduction of the dense matrix exponential
- Introduction of the
solve()
function for dense linear systems - Support for 64-bit BLAS and LAPACK libraries
- Enable instance-specific alignment and padding configuration for
StaticVector
,HybridVector
,StaticMatrix
, andHybridMatrix
constexpr
ification ofHybridVector
andHybridMatrix
- Introduction of outer sum, outer difference, and outer quotient operations
- Introduction of N-ary
map()
operations for dense vectors and matrices (up toN<=6
) - Introduction of the
select()
function for dense vectors and matrices - Introduction of the
rank()
function for dense matrices - Introduction of the
declunilow()
anddecluniupp()
functions - Introduction of the
declstrlow()
anddeclstrupp()
functions - Introduction of the
nosimd()
function for vectors and matrices - Introduction of the
noalias()
function for vectors and matrices - Introduction of the
isPositiveDefinite()
function for dense matrices - Introduction of the
eigen()
expression - Introduction of the
svd()
expression - Introduction of a
std::array
constructor for all dense vectors and dense matrices - Introduction of
min()
andmax()
overloads for vector/scalar and matrix/scalar operations - Optimizations of the dense matrix/dense vector multiplication kernels
- Optimizations of the dense matrix/dense matrix multiplication kernels
- Extended support for C++17 class template argument deduction (CTAD)
We hope that these new additions and improvements enable you to get even more out of Blaze. Enjoy!
- [Configuration and Installation](https://bitbucket.org/blaze-lib/blaze/wiki/Configuration and Installation)
- [Getting Started](https://bitbucket.org/blaze-lib/blaze/wiki/Getting Started)
- Vectors
- [Vector Types](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Types)
- [Dense Vectors](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Types#!dense-vectors)
- [Sparse Vectors](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Types#!sparse-vectors)
- [Vector Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations)
- [Constructors](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!constructors)
- [Assignment](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!assignment)
- [Element Access](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!element-access)
- [Element Insertion](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!element-insertion)
- [Element Removal](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!element-removal)
- [Element Lookup](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!element-lookup)
- [Non-Modifying Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!non-modifying-operations)
- [Modifying Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!modifying-operations)
- [Arithmetic Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!arithmetic-operations)
- [Reduction Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!reduction-operations)
- [Norms](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!norms)
- [Scalar Expansion](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!scalar-expansion)
- [Vector Expansion](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!vector-expansion)
- [Vector Repetition](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!vector-repetition)
- [Statistic Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!statistic-operations)
- [Declaration Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!declaration-operations)
- [Vector Generators](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Operations#!vector-generators)
- [Vector Types](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Types)
- Matrices
- [Matrix Types](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Types)
- [Dense Matrices](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Types#!dense-matrices)
- [Sparse Matrices](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Types#!sparse-matrices)
- [Matrix Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations)
- [Constructors](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!constructors)
- [Assignment](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!assignment)
- [Element Access](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!element-access)
- [Element Insertion](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!element-insertion)
- [Element Removal](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!element-removal)
- [Element Lookup](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!element-lookup)
- [Non-Modifying Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!non-modifying-operations)
- [Modifying Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!modifying-operations)
- [Arithmetic Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!arithmetic-operations)
- [Reduction Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!reduction-operations)
- [Norms](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!norms)
- [Scalar Expansion](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!scalar-expansion)
- [Matrix Repetition](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!matrix-repetition)
- [Statistic Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!statistic-operations)
- [Declaration Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!declaration-operations)
- [Matrix Generators](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!matrix-generators)
- [Matrix Inversion](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!matrix-inversion)
- [Matrix Exponential](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!matrix-exponential)
- [Matrix Decomposition](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!matrix-decomposition)
- [Linear Systems](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!linear-systems)
- [Eigenvalues/Eigenvectors](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!eigenvalueseigenvectors)
- [Singular Values/Singular Vectors](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Operations#!singular-valuessingular-vectors)
- [Matrix Types](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Types)
- Adaptors
- [Symmetric Matrices](https://bitbucket.org/blaze-lib/blaze/wiki/Symmetric Matrices)
- [Hermitian Matrices](https://bitbucket.org/blaze-lib/blaze/wiki/Hermitian Matrices)
- [Triangular Matrices](https://bitbucket.org/blaze-lib/blaze/wiki/Triangular Matrices)
- Views
- Subvectors
- [Element Selections](https://bitbucket.org/blaze-lib/blaze/wiki/Element Selections)
- Submatrices
- Rows
- [Row Selections](https://bitbucket.org/blaze-lib/blaze/wiki/Row Selections)
- Columns
- [Column Selections](https://bitbucket.org/blaze-lib/blaze/wiki/Column Selections)
- Bands
- [Arithmetic Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Arithmetic Operations)
- Addition
- Subtraction
- [Scalar Multiplication](https://bitbucket.org/blaze-lib/blaze/wiki/Scalar Multiplication)
- [Vector/Vector Multiplication](https://bitbucket.org/blaze-lib/blaze/wiki/Vector-Vector Multiplication)
- [Componentwise Multiplication](https://bitbucket.org/blaze-lib/blaze/wiki/Vector-Vector Multiplication#!componentwise-multiplication)
- [Inner Product / Scalar Product / Dot Product](https://bitbucket.org/blaze-lib/blaze/wiki/Vector-Vector Multiplication#!inner-product-scalar-product-dot-product)
- [Outer Product](https://bitbucket.org/blaze-lib/blaze/wiki/Vector-Vector Multiplication#!outer-product)
- [Cross Product](https://bitbucket.org/blaze-lib/blaze/wiki/Vector-Vector Multiplication#!cross-product)
- [Kronecker Product](https://bitbucket.org/blaze-lib/blaze/wiki/Vector-Vector Multiplication#!kronecker-product)
- [Vector/Vector Division](https://bitbucket.org/blaze-lib/blaze/wiki/Vector-Vector Division)
- [Matrix/Vector Multiplication](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix-Vector Multiplication)
- [Matrix/Matrix Multiplication](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix-Matrix Multiplication)
- [Schur Product](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix-Matrix Multiplication#!componentwise-multiplication-schur-product)
- [Matrix Product](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix-Matrix Multiplication#!matrix-product)
- [Kronecker Product](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix-Matrix Multiplication#!kronecker-product)
- [Bitwise Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Arithmetic Operations)
- [Bitwise Shift](https://bitbucket.org/blaze-lib/blaze/wiki/Bitwise Shift)
- [Bitwise AND](https://bitbucket.org/blaze-lib/blaze/wiki/Bitwise AND)
- [Bitwise OR](https://bitbucket.org/blaze-lib/blaze/wiki/Bitwise OR)
- [Bitwise XOR](https://bitbucket.org/blaze-lib/blaze/wiki/Bitwise XOR)
- [Logical Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Arithmetic Operations)
- [Logical NOT](https://bitbucket.org/blaze-lib/blaze/wiki/Logical NOT)
- [Logical AND](https://bitbucket.org/blaze-lib/blaze/wiki/Logical AND)
- [Logical OR](https://bitbucket.org/blaze-lib/blaze/wiki/Logical OR)
- [Shared-Memory Parallelization](https://bitbucket.org/blaze-lib/blaze/wiki/Shared Memory Parallelization)
- [HPX Parallelization](https://bitbucket.org/blaze-lib/blaze/wiki/HPX Parallelization)
- [C++11 Thread Parallelization](https://bitbucket.org/blaze-lib/blaze/wiki/Cpp Thread Parallelization)
- [Boost Thread Parallelization](https://bitbucket.org/blaze-lib/blaze/wiki/Boost Thread Parallelization)
- [OpenMP Parallelization](https://bitbucket.org/blaze-lib/blaze/wiki/OpenMP Parallelization)
- [Serial Execution](https://bitbucket.org/blaze-lib/blaze/wiki/Serial Execution)
- Serialization
- [Vector Serialization](https://bitbucket.org/blaze-lib/blaze/wiki/Vector Serialization)
- [Matrix Serialization](https://bitbucket.org/blaze-lib/blaze/wiki/Matrix Serialization)
- Customization
- [Configuration Files](https://bitbucket.org/blaze-lib/blaze/wiki/Configuration Files)
- [Vector and Matrix Customization](https://bitbucket.org/blaze-lib/blaze/wiki/Vector and Matrix Customization)
- [Custom Data Members](https://bitbucket.org/blaze-lib/blaze/wiki/Vector and Matrix Customization#!custom-data-members)
- [Custom Operations](https://bitbucket.org/blaze-lib/blaze/wiki/Vector and Matrix Customization#!custom-operations)
- [Custom Data Types](https://bitbucket.org/blaze-lib/blaze/wiki/Vector and Matrix Customization#!custom-data-types)
- Grouping/Tagging
- [Error Reporting Customization](https://bitbucket.org/blaze-lib/blaze/wiki/Error Reporting Customization)
- [BLAS Functions](https://bitbucket.org/blaze-lib/blaze/wiki/BLAS Functions)
- [LAPACK Functions](https://bitbucket.org/blaze-lib/blaze/wiki/LAPACK Functions)
- [Block Vectors and Matrices](https://bitbucket.org/blaze-lib/blaze/wiki/Block Vectors and Matrices)
- [Intra-Statement Optimization](https://bitbucket.org/blaze-lib/blaze/wiki/Intra-Statement Optimization)
- Frequently Asked Questions (FAQ)
- [Issue Creation Guidelines](https://bitbucket.org/blaze-lib/blaze/wiki/Issue Creation Guidelines)
- [Blaze References](https://bitbucket.org/blaze-lib/blaze/wiki/Blaze References)
- Blazemark: The Blaze Benchmark Suite
- Benchmarks/Performance Results
- [Release Archive](https://bitbucket.org/blaze-lib/blaze/wiki/Release Archive)
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 6.0 through 10.2), the Clang compiler (version 5.0 through 10.0), and Visual C++ 2017 (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
Jannik Schürg -- AVX-512 support and cache size detection for macOS in CMake
Marcin Copik -- CMake fixes
Hartmut Kaiser -- HPX backend
Patrick Diehl -- Integration of HPX to the Blazemark and maintainer of the Blaze Fedora package
Mario Emmenlauer -- Blazemark extensions
Jeff Pollock -- CMake extensions
Darcy Beurle -- Integration of Blaze into the Compiler Explorer
Robert Schumacher -- CMake fixes
Jan Rudolph -- CMake fixes
Mikhail Katliar -- LAPACK extensions
Daniel Baker -- Integration of Sleef
Thijs Withaar -- LAPACK extensions