From: "Nasser M. Abbasi" <nma@12000.org>
Subject: Re: on using array index, vectorized operation
Date: Sun, 27 Mar 2011 15:12:10 -0700
Date: 2011-03-27T15:12:10-07:00 [thread overview]
Message-ID: <imocnq$2un$1@speranza.aioe.org> (raw)
In-Reply-To: fb767787-792d-4de3-b455-4ebab13da567@x1g2000yqb.googlegroups.com
On 3/27/2011 3:09 PM, Phil Clayton wrote:
> 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)?
>
Yes, sorry, ofcourse in the actuall code I have
LOOP over i
u_new(i) = u(i)- .....
END LOOP
But when I posted it to this newsgroup, I was editing things by hand
to show.
Here is the actual code
http://12000.org/my_notes/solve_advection_1D_in_Ada/source/lax_wendroff_pkg.adb
>
>> 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
--Nasser
next prev parent reply other threads:[~2011-03-27 22:12 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
2011-03-27 22:12 ` Nasser M. Abbasi [this message]
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