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,b375f07e05d12c7a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-13 01:07:46 PST Path: archiver1.google.com!news2.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!newscore.gigabell.net!fu-berlin.de!uni-berlin.de!ailinel.cbb-automation.DE!not-for-mail From: dmitry@elros.cbb-automation.de (Dmitry Kazakov) Newsgroups: comp.lang.ada Subject: Re: efficient vector/matrix operations in Ada Date: Mon, 13 Aug 2001 07:50:33 GMT Message-ID: <3b7781ea.292937@news.cis.dfn.de> References: <3B6F40C1.FD215D1D@sneakemail.com> <3B6F5ABC.3C40E189@sneakemail.com> <9f6e2b77.0108100854.66b084b4@posting.google.com> NNTP-Posting-Host: ailinel.cbb-automation.de (212.79.194.99) X-Trace: fu-berlin.de 997689034 8211747 212.79.194.99 (16 [77047]) X-Newsreader: Forte Free Agent 1.21/32.243 Xref: archiver1.google.com comp.lang.ada:11833 Date: 2001-08-13T07:50:33+00:00 List-Id: On 10 Aug 2001 09:54:33 -0700, B_Gaffney@My-Deja.com (B.Gaffney) wrote: >"Russ P." <18k11tm001@sneakemail.com> wrote in message news:<3B6F5ABC.3C40E189@sneakemail.com>... >> No, you really need the dynamically instantiated temporary matrix, I >> believe. I've been through this little lesson years ago. Don't forget >> that you also need to be able to handle expressions such as "A = B + C + >> D;". You can play complicated games with static arrays of "work" >> matrices, but you are asking for trouble and the resulting code is >> likely to not be re-entrant. > >Um, OK, but how would you handle this case using your "+=" >implementation? That was your original point wasn't it? One could allow to define "accelerators" for binary and unary operations. For instance: function "+" (A, B : Matrix) return Matrix; procedure InPlaceSum (A : in out Matrix, B : Matrix); pragma Accelerator (InPlaceSum, "+"); The compiler should replace calls to "+" with calls to InPlaceSum if the left argument is temporal. So B+C+D has to be compiled into: InPlaceSum ("+"(B,C),D) [or silently ignore the pragma (:-))] As for +=, it would be nice to extend the set of operators in Ada. However it should be done in a consistent manner, i.e. for each operator @ there should a @:= counterpart. Like "<=:=" for "<=". A bit cumsy, isn't it? And what to do with "and" or "abs"? (:-)) Regards, Dmitry Kazakov