Element-wise operations in C++

Viewed 11499

Is there a preexisting library that will let me create array-like objects which have the following properties:

  1. Run time size specification (chosen at instantition, not grown or shrunk afterwards)
  2. Operators overloaded to perform element wise operations (i.e. c=a+b will result in a vector c with c[i]=a[i]+b[i] for all i, and similarly for *, -, /, etc)
  3. A good set of functions which act elementwise, for example x=sqrt(vec) will have elements x[i]=sqrt(vec[i])
  4. Provide "summarising" functions such as sum(vec), mean(vec) etc
  5. (Optional) Operations can be sent to a GPU for processing.

Basically something like the way arrays work in Fortran, with all of the implementation hidden. Currently I am using vector from the STL and manually overloading the operators, but I feel like this is probably a solved problem.

3 Answers
Related