comp.lang.ada
 help / color / mirror / Atom feed
From: Bill Findlay <yaldnifw@blueyonder.co.uk>
Subject: Re: In place matrix multiplication?
Date: Sun, 01 Jun 2003 15:26:00 +0100
Date: 2003-06-01T15:26:00+01:00	[thread overview]
Message-ID: <BAFFCB88.2F5D%yaldnifw@blueyonder.co.uk> (raw)
In-Reply-To: BxnCa.16707$Mu3.366629@newsfep4-glfd.server.ntli.net

On 1/6/03 13:54, in article
BxnCa.16707$Mu3.366629@newsfep4-glfd.server.ntli.net, "chris.danx"
<spamoff.danx@ntlworld.com> wrote:

> I've simplified it by just using a floating point type, rather than an
> abstraction (the abstraction provided only additional complexity and
> little benefit otherwise).

Matrix multiplication is useful with matrices having integer elements and
boolean elements (e.g. representing relations, and graph-theory adjacency
and path length).

It would be interesting to know how well versions instantiated with float,
integer and boolean types compare in terms of performance with non-generic
versions, especially using GNAT.

> Now I'm wondering if the cost of the more
> complex code is more expensive than doing an out of place multiplication
> followed by a copy back to the original array.  I guess that'd depend on
> the code and the compiler.  How do I find out which is cheaper in time
> for a given compiler (GNAT)?

For large (square) matrices, in-place lets you run a 50% bigger problem in
the same amount of cache. It also much improves locality of reference.
I would guess that these effects would more than outweigh the extra copying
done by the in-place version. But I could be wrong. You need to run some
tests and see ...

-- 
Bill-Findlay chez blue-yonder.co.uk ("-" => "")

P.S. I hope the exams went well!




      reply	other threads:[~2003-06-01 14:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-01  0:35 In place matrix multiplication? chris.danx
2003-06-01  9:18 ` Dmitry A. Kazakov
2003-06-01 12:54   ` chris.danx
2003-06-01 14:26     ` Bill Findlay [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox