ArrayOps
Vector Computation In C++

Introduction

ArrayOps is a library of source-code files enabling you to perform vector computations in C++, and is in many regards similar to the valarray-class of the Standard Template Library (STL). However, ArrayOps employs socalled Template Meta-Programming along with other advanced object-oriented programming techniques, to improve efficiency and flexibility. ArrayOps essentially provides syntactic sugar for vector-notation, that automatically compiles into a single flattened loop, for each assignment involving such vector expressions.

ArrayOps has a number of advantages over similar existing libraries (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. ArrayOps is still strong-typed though, in that you must explicitly convert between the element-datatypes of vectors; and in debug-mode, the sizes of the vectors involved in arithmetic expressions, are also asserted to match.

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<double> 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<A.Size(); i++)
{
A[i] = b*B[i] + c*C[i];
}

Where the datatypes are ensured to be the same at compile-time, and the sizes of the arrays are asserted to match in debug-mode. Note that no implicit allocations of socalled temporaries take place, as would be the case if the valarray-class from the STL had been used.

License

ArrayOps is intended to be used (and improved) by as many people as possible, and both in scientific and commercial settings, without imposing any responsibility on the author(s) of ArrayOps. It is therefore published under the GNU Lesser General Public License, which essentially means that you may distribute commercial programs that link with the ArrayOps library, as well as make alterations to the ArrayOps library itself. There are certain terms to be met though, please see the license for details.

Installation

Installing and using ArrayOps is incredibly simple, as there are no code-libraries that have to be compiled, and ArrayOps only consists of C++ header-files. Simply do the following:

  1. Download the ArrayOps source-code (see below).
  2. Unpack the ArrayOps source-code to a directory of your choice.
  3. Add that directory to the include-paths of your C++ project.
  4. Add #include statements to your source-code, for the ArrayOps datatypes that you need (e.g. Array, ArrayMini, or ArrayUse).
  5. Write your source-code using ArrayOps, and compile.

Compatibility

ArrayOps was developed in MS Visual C++ 2005, and as the source-code relies on fairly new programming techniques, it may not be compatible with all C++ compilers.

The parallel features of ArrayOps have not been tested beyond their ability to compile, but parallelism may be disabled during compilation, by either switching off OpenMP support in the C++ compiler, or by forcing all arrays to be non-parallel.

Download

This version is believed to be compatible with previous versions of ArrayOps. But even though the current version of ArrayOps is considered fully functional, the library is still in development, and particularly the more exotic features as well as the internal framework, may change in future versions.

Newest Version

The test-program is implemented in MS Visual C++ 2005, and may require a bit of porting to make it work with other compilers.

Previous Versions

Contact

Please direct technical questions to the suggested newsgroup, instead of the personal e-mail address. It is not that we do not want to help you, but we have many other things to do, so please study the manual and source-code thoroughly, then ask the newsgroup, and as a final resort, you could try asking us. Suggestions and bug-reports are of course most welcome, and indeed, we are looking for others to assist in the development of ArrayOps.

Newsgroup

There is no newsgroup dedicated to ArrayOps, but you could try searching and asking questions in the sci.math.num-analysis newsgroup.

E-Mail

Feel free to let us know if ArrayOps has been helpful to you in any way, or if you have any bug-fixes. But technical questions should first be directed to the newsgroup suggested above.


(C) Copyright 2006-2008 Hvass Labs. All rights reserved.
All trademarks are properties of their respective owners.