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.1 required=5.0 tests=BAYES_05,CTE_8BIT_MISMATCH, FREEMAIL_FROM,HELO_NO_DOMAIN,MAILING_LIST_MULTI, PP_MIME_FAKE_ASCII_TEXT,RDNS_NONE,SPOOFED_FREEMAIL_NO_RDNS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,b375f07e05d12c7a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-14 03:12:51 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!193.251.151.101!opentransit.net!wanadoo.fr!freenix!enst!enst.fr!not-for-mail From: "Gautier Write-only-address" Newsgroups: comp.lang.ada Subject: Re: efficient vector/matrix operations in Fortran, was Re: ... in Ada Date: Tue, 14 Aug 2001 10:11:18 +0000 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: avanie.enst.fr 997783970 90819 137.194.161.2 (14 Aug 2001 10:12:50 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 14 Aug 2001 10:12:50 +0000 (UTC) To: comp.lang.ada@ada.eu.org Return-Path: X-Originating-IP: [194.40.39.50] X-OriginalArrivalTime: 14 Aug 2001 10:11:18.0414 (UTC) FILETIME=[759952E0:01C124A9] Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.4 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , List-Archive: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:11901 Date: 2001-08-14T10:11:18+00:00 > The existence of Fortran, which has long been used successfully >for highly efficient vector/matrix code, demonstrates that += is >not required. > One possible reason is that significant matrix/vector programs >don't normally spend a lot of their time doing a += b type O(n**2) >operations, but rather spend their time doing O(n**3) operations. >+= would be of minor benefit in that case. The real reason is the "+" operator is defined in the language for vectors or matrices, not a programmable function like in Ada. Or, say, it has a pragma Import(intrinsic,...) like for functions in Standard or Interfaces. So the Fortran compiler optimizes with full latitude. With a <>, and no trick to tell the compiler that it is intrisic, you have a local variable in your function, perform the addition, and return the variable. Maybe a pragma Inline and a strong optimization can do the job on some compilers. It would be interesting to see if at least one is able to suppress the local variable in an inlined call. If not, there is no chance that a user-defined "+" is as efficient as a user-defined "+=". ________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: Do not answer to sender address, visit the Web site! Ne r�pondez pas � l'exp�diteur, visitez le site ouaibe! _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp