![]() |
Blitz Support : |
From: Julian Cummings (cummings_at_[hidden])
Date: 2004-03-16 15:06:29
If you are working exclusively with small 3x3 matrices, you may wish to
have a look at the tvmet package on SourceForge.net. It uses expression
templates and template metaprograms to evaluate expressions involving
small vectors and matrices with extents that are known at compile time.
It also will produce temporaries in places where it is more efficient
to do so, as in your example below. The blitz library has a set of
TinyVector and TinyMatrix classes for this purpose as well, but the
classes in tvmet are more completely developed at this point. There is a
plan to replace the blitz Tiny classes with the tvmet classes at some
point in the future (whenever I can scrape together enough time to
tackle this). I recently encouraged the maintainer of tvmet to add
support for complex elements, so it should have all that you need at
this point.
Regards, Julian C.
Colin Morningstar wrote:
>Dear Mr. Veldhuizen:
>
> I am currently trying to use expression templates to write C++ code
>to efficiently manipulate 3x3 complex matrices (SU(3) matrices for use
>in lattice QCD simulations) including SSE inline assembly on pentium
>clusters. A colleague brought Blitz++ to my attention, so I have a
>quick question about it, if I may.
> In an expression such as
>
> A = B*C*D*adjoint(F)
>
>where A,B,C,D,F are 3x3 complex matrices, would Blitz++ completely
>unroll all of the loops in this expression (which is not optimal for
>me), or would it evaluate B*C -> T1 (temporary), T1*D-> T2, etc.?
>
> The use of templates to efficiently evaluate matrix expressions is a
>clever idea. Thanks. Having programmed in Fortran for so long, the
>transition to C++ with templates is not as smooth as I had hoped.
>
>Regards,
>Colin Morningstar
>
>
>
>
-- Dr. Julian C. Cummings E-mail: cummings_at_[hidden] California Institute of Technology Phone: 626-395-2543 1200 E. California Blvd., Mail Code 158-79 Fax: 626-584-5917 Pasadena, CA 91125