Skip to content

Features

Sylwester Arabas edited this page Sep 7, 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(10);
  blitz::Array<bool, 2> binmtx(10,10);
  blitz::Array<double, 3> dblarr(32,64,128);
  blitz::Array<float, 11> ftensor(3,3,3,3,3,3,3,3,3,3,3);
}
$ g++ example.cpp
$ ./a.out 
  • Initialisation:
#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 2 ]
  • Partial evaluation / lack of temporary objects with loop-free array arithmetics:
  • Tensor notation:
  • 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:
Clone this wiki locally