https://github.com/hvass-labs/arrayops
Vector Computation in C++
https://github.com/hvass-labs/arrayops
Last synced: 6 months ago
JSON representation
Vector Computation in C++
- Host: GitHub
- URL: https://github.com/hvass-labs/arrayops
- Owner: Hvass-Labs
- License: lgpl-2.1
- Created: 2020-02-09T13:40:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-09T13:55:34.000Z (over 5 years ago)
- Last Synced: 2025-02-09T09:12:42.043Z (8 months ago)
- Size: 405 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ArrayOps
ArrayOps is my old library from 2006 for performing vector computations in C++. It is conceptually similar to the valarray-class of the Standard Template Library (STL). However, ArrayOps employs socalled [Template Meta-Programming](http://en.wikipedia.org/wiki/Template_metaprogramming) along with other advanced object-oriented programming techniques to improve efficiency and flexibility. ArrayOps essentially provides syntactic sugar for vector-notation which automatically compiles into a single flattened loop for each assignment involving vector expressions.
ArrayOps had a number of advantages over similar libraries from that time (e.g. Blitz++ and POOMA), including a much simpler framework that easens the maintenance and user-specialization, which means ArrayOps also provides different vector-datatypes that are tailored to specific needs, and all vector-datatypes may be combined arbitrarily in arithmetic expressions.
## Example
To illustrate the basic idea of ArrayOps, consider the following C++ source-code example where we create and manipulate three arrays, each containing 100 elements:
const unsigned int k = 100;
ArrayOps::Array A(k), B(k), C(k);
double b, c;// Read numbers b and c from somewhere ...
// Read arrays B and C from somewhere ...A = b*B + c*C;
Here, due to the use of socalled meta-programming, the last line is automatically transformed at compile-time into the following loop:
for (unsigned int i=0; i