Re: OON: RE: alpha release of MET, C++ matrix with expression templates

From: Masakatsu ITO (mito@masa.ims.ac.jp)
Date: Thu Feb 15 2001 - 04:00:24 EST


> How does MET differ from MTL? How would someone choose one over the other?

MET is not intended to compete with other matrix and array libraries and
the way to choose a matrix library depends on the purpose.
So let me explain my personal itch.

I had always wanted to simplify the fortran codes for linear algebraic
expressions. Consider u = M*v + w, where u,v and w are vectors and
M is matrix. Fortran requires multiple loops or subroutine calls with
complicated argument list. But it was said until recently,
C++ abstraction was the enemy of performance. A naive implementation
of overloaded operators introduces temporary and copies of objects.

Hence some library force you to give up using overloaded operators
and write the code like

        multiply_add_and_assign(u,m,v,w);

whose order of arguments is confusing for me.

Expression template is a way to eliminate that overhead but keep
the advantage of OOP. Using MET, you can simply write u = m*v + w
in your source without any temporaries or copies.

Well, I am afraid my explanation becomes too long. I think that
"C++ programming language" 3rd. ed. section 22.4.7 is a good
introduction for performance penalty of vector and matrix.
And blitz++ web site ( http://oonumerics.org/blitz/ ) provides
more detailed explanation and references for expression template technique.

I hope MET might give a test-bed for expression templates or
some starting point for your scientific/engineering programming.

Regards,
Masakatsu Ito
Computer Center of Institute for Molecular Science
E-mail mito@ims.ac.jp

--------------------- Object Oriented Numerics List --------------------------
* To subscribe/unsubscribe: use the handy web form at
http://oonumerics.org/oon/
* If this doesn't work, please send a note to owner-oon-list@oonumerics.org



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