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-Thread: 103376,4692663255b51613 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!x1g2000yqb.googlegroups.com!not-for-mail From: Phil Clayton Newsgroups: comp.lang.ada Subject: Re: on using array index, vectorized operation Date: Sun, 27 Mar 2011 15:09:04 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 91.110.161.61 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1301263744 14674 127.0.0.1 (27 Mar 2011 22:09:04 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 27 Mar 2011 22:09:04 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x1g2000yqb.googlegroups.com; posting-host=91.110.161.61; posting-account=v7gx3AoAAABfjb9m5b7l_Lt2KVEgQBIe User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.1.9) Gecko/20100330 Fedora/3.5.9-1.fc12 Firefox/3.5.9,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:19487 Date: 2011-03-27T15:09:04-07:00 List-Id: On Mar 27, 9:44=A0pm, "Nasser M. Abbasi" wrote: > Let me explain. Here is lax-wendroff scheme for 1-D advection pde, where > 'u' below is the solution: > > u(i):=3Du(i)-(a/2.0)*(u(i+1)-u(i-1))+(a**2)/2.0*(u(i-1)-2.0*u(i)+u(i+1)); > > Where in the above, 'i' is the index range that I set up myself before. > > In Ada, I put the above line inside a loop over 'i'. I notice that the rhs mentions u(i+1) and u(i-1) so depending on whether you're decrementing or incrementing i, one of these will be overwritten on a previous loop iteration. Presumably that isn't intended (looking at your vectorized code)? > Using your solution, I would have to write > > u(u'first+1..u'last-1) :=3Du(u'first+1..u'last-1) - > =A0 =A0 =A0 =A0 =A0(a/2.0)* (u(u'first+2..u'last) - u(u'first..u'last-2))= + > =A0 =A0 =A0 =A0 =A0(a**2)/2.0* =A0( u(u'first..u'last-2)-2.0*u(u'first+1.= .u'last-1) + > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0u(u'first+2..u'last)) = ; Do we now have vectorized arithmetic operations, e.g. + on array types? Phil