High-performance C++ multi-dimensional arrays

前端 未结 8 1017
天涯浪人
天涯浪人 2021-02-04 09:29

I am looking for advice regarding high performance multi-dimensional array libraries/classes for C++. What I really need is:

  • the ability to dynamically allocate

相关标签:
8条回答
  • 2021-02-04 09:36

    With the caveat that this is shameless self-promotion,

    https://github.com/ndarray/ndarray

    may be worth looking into.

    While it doesn't provide optimized mathematical operators, it does provide an interface to Eigen for that. Where it really stands out is in providing interoperability with Python/NumPy through SWIG or Boost.Python.

    0 讨论(0)
  • 2021-02-04 09:41

    Maybe library such as BLAS, a CBLAS exists, but don't remember where.

    http://www.netlib.org/blas/

    0 讨论(0)
  • 2021-02-04 09:44
    • uBlas, a part of Boost. It offers full BLAS level 1-3, and hence lots of array arithmetic functions.
    • Armadillo also seems to be a C++ linear algebra library, which as far as I can see optionally uses LAPACK/Atlas (which of course makes it canonically fast).
    • The GNU Scientific Library offers full BLAS. I don't know how fast it is, or if it can use LAPACK/Atlas.
    • If you don't need anything more fancy than what you list, you can quite easily wrap for example Atlas' BLAS yourself. But you probably don't want to reinvent the wheel if you don't have to.
    0 讨论(0)
  • 2021-02-04 09:45

    Necomi seems to provide the features you would like.

    It includes support for an arbitrary multi-dimensional numbers whose dimensions can be fixed at runtime, provides fast access to single elements, while also supporting arithmetic (among others) expressions.

    0 讨论(0)
  • 2021-02-04 09:50

    There is a broad and relatively recent survey, including benchmarks, here.

    I believe that you can speed up Boost.UBlas by binding it to underlying numerical libraries like LAPACK or Intel MKL, but have not done that.

    fwiw, the implementations that seem to come up most often as candidates are Boost.UBlas and MTL. It's my experience that wide adoption is more likely to foster ongoing support and development.

    0 讨论(0)
  • 2021-02-04 09:52

    Eigen is extremely well-maintained (right now, at least, there are new versions coming out every month) and supports the other operations you need.

    0 讨论(0)
提交回复
热议问题