comp.lang.ada
 help / color / mirror / Atom feed
From: Phil Clayton <phil.clayton@lineone.net>
Subject: Re: on using array index, vectorized operation
Date: Sun, 27 Mar 2011 15:09:04 -0700 (PDT)
Date: 2011-03-27T15:09:04-07:00	[thread overview]
Message-ID: <fb767787-792d-4de3-b455-4ebab13da567@x1g2000yqb.googlegroups.com> (raw)
In-Reply-To: imo7jn$ll4$1@speranza.aioe.org

On Mar 27, 9:44 pm, "Nasser M. Abbasi" <n...@12000.org> wrote:
> Let me explain. Here is lax-wendroff scheme for 1-D advection pde, where
> 'u' below is the solution:
>
> u(i):=u(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) :=u(u'first+1..u'last-1) -
>          (a/2.0)* (u(u'first+2..u'last) - u(u'first..u'last-2))+
>          (a**2)/2.0*  ( u(u'first..u'last-2)-2.0*u(u'first+1..u'last-1) +
>                          u(u'first+2..u'last)) ;

Do we now have vectorized arithmetic operations, e.g. + on array
types?

Phil



  parent reply	other threads:[~2011-03-27 22:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-27  1:31 on using array index, vectorized operation Nasser M. Abbasi
2011-03-27 18:48 ` Nasser M. Abbasi
2011-03-27 20:01 ` Cyrille
2011-03-27 20:44   ` Nasser M. Abbasi
2011-03-27 21:02     ` Pascal Obry
2011-03-27 21:30     ` Shark8
2011-03-27 22:00       ` Nasser M. Abbasi
2011-03-27 22:37         ` Phil Clayton
2011-03-27 22:43           ` Nasser M. Abbasi
2011-03-27 22:59             ` Phil Clayton
2011-03-27 22:09     ` Phil Clayton [this message]
2011-03-27 22:12       ` Nasser M. Abbasi
2011-03-27 22:23       ` Nasser M. Abbasi
2011-03-29  2:50         ` Randy Brukardt
2011-03-29  4:55           ` Nasser M. Abbasi
2011-03-29 20:11             ` Phil Clayton
2011-03-29 21:17               ` Nasser M. Abbasi
2011-03-29 22:49                 ` Phil Clayton
2011-03-29 23:47                   ` Nasser M. Abbasi
2011-03-30 13:00                     ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox