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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,60e2922351e0e780 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-08 00:22:49 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: 18k11tm001@sneakemail.com (Russ) Newsgroups: comp.lang.ada Subject: Re: Clause "with and use" Date: 8 Nov 2003 00:22:48 -0800 Organization: http://groups.google.com Message-ID: References: news@kiuk0156.chembio.ntnu.no> <3FA777E9.4030605@noplace.com> NNTP-Posting-Host: 63.194.87.148 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1068279768 24983 127.0.0.1 (8 Nov 2003 08:22:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 8 Nov 2003 08:22:48 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:2249 Date: 2003-11-08T00:22:48-08:00 List-Id: "Martin Dowie" wrote in message news:... > "Russ" <18k11tm001@sneakemail.com> wrote in message > news:bebbba07.0311071231.239981ea@posting.google.com... > > > So, Russ, have read AI-318? Do you still think that "+=",etc is > > > still necessary, now there is a mechanism to avoid that extra deep > > > copy for things like matrices/vectors? > > > > I started to read it, but it's a bit too technical for me. Too many of > > those wierd vowels. 8^) I don't know if it solves the problem of > > efficient vector/matrix operations, but it if does, it sure looks a > > lot more complicated to me than "+=" (or ":+"). If you have time, I > > would appreciate an example of how it would be used for matrix > > addition, for example. Just the calling statement using an overloaded > > "+" will be sufficient. > > That's exactly what it's getting at (provided the "+" operator is defined > correctly :-) I certainly appreciate your taking the time to answer my question. > A := B * C; -- would not require an extra copy I'm just a bit puzzled as to why you immediately shifted from "+" to "*". Correct me if I am wrong, but I believe that general matrix multiplication is impossible to do without a temporary matrix (or other work space). Unlike matrix addition, you cannot simply overwrite the elements of one of the input matrices. So although you can eliminate a copy operation, you probably cannot eliminate the construction and destruction of a temporary (assuming you require reentrant code). In any case, am I correct in assuming that AI-318 would eliminate *both* the copy operation *and* the temporary for matrix addition (as "+=" would do)? That is, can I use A := A + B; -- or A := B + C; and avoid both the temporary and the copy operation? If so, then I gladly concede that my case for "+=" (or ":+") is weakened. As you know, however, I am a hard-core fanatic, and I still think ":+" is a good idea even just for scalar operations. By the way, it would be nice to retain the full efficiency even for cascaded expressions such as A := B + C + D; However, it is not critical because you can always break these expressions up into simpler expressions. Of course, you will only do that if you are aware of what causes temporaries and extra copying to be generated.