OON: New release of template composite operators library.

From: Brian Parker (bparker@gil.com.au)
Date: Wed Apr 30 1997 - 05:09:01 EST


Hi all,
I have ported my template composite operators library to Visual C++ v5.0.
This library adds support for composite operators to C++.

It is downloadable from http://www.gil.com.au/~bparker/

It is almost fully functional under VC++ 5.0; the only significant
remaining limitation is that it can't be used to define templated types.
That will be rectified when VC++ supports template function partial
ordering. This release should also port more easily to other sufficiently
draft-compliant compilers.

I have also included a more substantial example matrix class which
demonstrates some of the optimisation possibilities that the library
provides, for example a rank-2k update expression results in a single level
3 BLAS call, for a 3.6 X speedup, and an expression of four array additions
gives a 6.4 X speedup. The complete timing results are available at the
above site.

As previously, I have placed the code into the public domain.

The following is a brief overview of the library from the web site-

Composite operators are operators that are not limited to the pair-wise
evaluation of the built-in operators- they are called with all of the
operands of an entire expression or subexpression, allowing advanced
optimisations to be performed, and avoiding the temporary production of the
built-in operators.

The template composite operators library adds composite operator support to
C++ by using the draft standard template facilities- it is an extension of
the expression templates technique.

A composite operator in this library has the form-

void CompositeOp(TYPE& lhs, const OPCLASS & rhs);

where OPCLASS is a nested template class representing an arbitrarily complex
expression and lhs stores the result of the expression evaluation e.g.

void CompositeOp(matrix& lhs, const Plus<Times<matrix, double>, matrix>& rhs);

will be called for any expression or subexpression matching the signature:
matrix * double + matrix.

An advantage of this library is that it will remove all possible temporaries
in most cases, even if no matching optimised composite operators are found.

Existing or new classes can be easily adapted to use the library-
essentially it entails including the CompositeOp.h header, using several
macros to register the class with the library and then writing the composite
operators (including pair-wise versions which replace the member or global
operators of a typical implementation).

I would be interested in any feedback on this library.

Thanks,
Brian Parker (bparker@gil.com.au)



This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 03:20:05 EST