Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-08-01 08:07:50


Larry Evans <cppljevans_at_[hidden]> writes:

> On 07/25/2005 07:16 PM, Larry Evans wrote:
> [snip]
>> I can see where this would be useful in forming cross product.
>> If, instead of scalar elements in the tuples, the rows of matrix
>> M1 and columns of matrix M2 were elements of these tuples, then
>> you could simply apply zip_iterator to each of these and then
>> multiply each element of that iterator and then accummulate
>> that with plus and end up with matrix multiply!
>
> Well, this *may* not be the most efficient method for
> implementing matrix multiply ;) My enthusiasm blinded
> my common sense. However, I've also got this wild idea
> that maybe template metaprogramming could maybe transform
> an matrix multiply expression written this way into a
> more efficient method. David (Abrahams), does this
> seem at all possible?

I don't really understand what you have in mind.

> I recall you were considering
> some sort of template library dealing with matrices
> or linear algebra or something of that sort.

Yes, I am working on it, but I'm not going to approach matrix
multiplication using anything like a cross product iterator. The key
ideas in efficient matrix multiplication are hierarchical
decomposition and blocking to make the best use of registers and
various levels of cache (not to mention SMPs).

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk