-
Notifications
You must be signed in to change notification settings - Fork 82
Features
Sylwester Arabas edited this page Sep 8, 2018
·
20 revisions
THIS PAGE IS WORK IN PROGRESS (COMMENTS AND CONTRIBUTIONS MORE THAN WELCOME!) WOULD BE GREAT TO COMPARE THE FEATURE LIST WITH OTHER PACKAGES
For comparison with other C++ array containters, see Alternatives
Major features:
- Header-only multi-dimensional (up to 11) matrix/array/tensor containers
#include <blitz/array.h>
int main()
{
blitz::Array<int, 1> intvec;
blitz::Array<bool, 2> binmtx;
blitz::Array<double, 3> dblarr;
blitz::Array<float, 11> ftensor;
}
$ g++ example.cpp
$ ./a.out
- Initialisation (single value or comma-delimited list of values):
#include <blitz/array.h>
int main()
{
blitz::Array<double,2> a(2,2), b(4,4);
a = 0;
b = 1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1;
std::cout << a << b;
}
$ g++ example.cpp
$ ./a.out
(0,1) x (0,1)
[ 0 0
0 0 ]
(0,3) x (0,3)
[ 1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1 ]
- Tensor notation (using blitz::tensor namespace members requires linking with lblitz):
#include <blitz/array.h>
int main()
{
blitz::Array<float,2> psi(4,4);
{
using namespace blitz::tensor;
psi = sqrt(i*i + j*j);
}
std::cout << psi;
}
$ g++ -lblitz test.cpp
$ ./a.out
(0,3) x (0,3)
[ 0 1 2 3
1 1.41421 2.23607 3.16228
2 2.23607 2.82843 3.60555
3 3.16228 3.60555 4.24264 ]
- Partial evaluation / lack of temporary objects with loop-free array arithmetics:
- Arbitrary ordering including C-style and Fortran-style
- Boundary checks in debug mode
- Multi-dimensional indexing/slicing with ints and Ranges
- Multi-dimensional indexing/slicing with single object (RectDomain) + rationale for overloading
- Operations on externally allocated memory (and dimension-ordering flexibility)
- Reference counting (optionally thread-safe)
- Array-expression-valued functions (incl. reference counting)
- Elemental functions
- Stencils
- Reductions, ternary-like operator
- Random Number Generators
- Vectorization
- Boost.MPI and Boost.serialization support:
- Tau profiler integration: