From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,701270dccdaf7b2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-01 07:27:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!c03.atl99!rip!news.webusenet.com!peer01.cox.net!cox.net!news-hub.cableinet.net!blueyonder!internal-news-hub.cableinet.net!news-binary.blueyonder.co.uk.POSTED!53ab2750!not-for-mail User-Agent: Microsoft-Entourage/10.1.1.2418 Subject: Re: In place matrix multiplication? From: Bill Findlay Newsgroups: comp.lang.ada Message-ID: References: <1JcCa.16479$Mu3.361103@newsfep4-glfd.server.ntli.net> Mime-version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Date: Sun, 01 Jun 2003 15:26:00 +0100 NNTP-Posting-Host: 80.195.75.181 X-Complaints-To: abuse@blueyonder.co.uk X-Trace: news-binary.blueyonder.co.uk 1054477625 80.195.75.181 (Sun, 01 Jun 2003 14:27:05 GMT) NNTP-Posting-Date: Sun, 01 Jun 2003 14:27:05 GMT Organization: blueyonder (post doesn't reflect views of blueyonder) Xref: archiver1.google.com comp.lang.ada:38285 Date: 2003-06-01T15:26:00+01:00 List-Id: On 1/6/03 13:54, in article BxnCa.16707$Mu3.366629@newsfep4-glfd.server.ntli.net, "chris.danx" 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!