-
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
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 example.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 ]
(TODO) Partial evaluation / lack of temporary objects with loop-free array arithmetics:
(TODO) Arbitrary ordering including C-style and Fortran-style
(TODO) Boundary checks in debug mode
(TODO) Multi-dimensional indexing/slicing with ints and Ranges
(TODO) Multi-dimensional indexing/slicing with single object (RectDomain) + rationale for overloading
(TODO) Operations on externally allocated memory (and dimension-ordering flexibility)
(TODO) Reference counting (optionally thread-safe)
(TODO) Array-expression-valued functions (incl. reference counting)
(TODO) Elemental functions
(TODO) Stencils
(TODO) Reductions, ternary-like operator
(TODO) Random Number Generators
(TODO) Vectorization
(TODO) Boost.MPI and Boost.serialization support
(TODO) Tau profiler integration