comp.lang.ada
 help / color / mirror / Atom feed
From: "Nasser M. Abbasi" <nma@12000.org>
Subject: Re: questions on using the array component iterator for 2012
Date: Mon, 25 Jun 2012 13:53:38 -0500
Date: 2012-06-25T13:53:38-05:00	[thread overview]
Message-ID: <jsac3f$pue$1@speranza.aioe.org> (raw)
In-Reply-To: 42e9adf6-5928-4742-b066-e3ec2b96e8cb@googlegroups.com

On 6/25/2012 1:19 PM, Adam Beneschan wrote:
> On Saturday, June 23, 2012 5:02:18 AM UTC-7, Nasser M. Abbasi wrote:

> That wouldn't even work, I think.
...
>
> New_A(i,j) := (1/4) (  A(i-1,j)+A(i+1,j)+A(i,j-1)+A(i,j+1)
>

For the LHS, there is  a jacobi iteration, which needs a
temporary matrix, like you have above, and there is gauss-siedel
iteration, which uses the same (in place) matrix. There are
many other types of iterations (called relaxations methods such
as sor, gauss-siedel with red/black variation, sor with chebyshev,
and may be more).

But that is all not really important.

What I was asking for, is using the new iterator, if one can
use it to access elements outside its "sphere of influence",
ie. to access 1-off it, or 2-off of it, up and down, etc. i.e.
convert it to an index locally so as to visits elements other
than it somehow.

But after thinking about it, I do not think this is
practical to do. If I wanted to do the above type iteration,
I'll just normal loops and use normal indices, not the
new iterator.

> (you left the ",j" off the index of the left-hand side)
>

yes, sure. I was writing things on the fly.

> and then A := New_A after all elements are computed.
>

Yes. For Jacobi. I've written all these algorithms many times
before in Matlab and in Mathematica. If you interested in the code,
Check my Mathematica applets here

http://12000.org/my_notes/mma_demos/index.htm

#25 in the table implements many solvers including Jacboi.
You can run in it the browser. (need plugin, free of charge,
see link there if interested). Firefox, etc.. but no plugin for
Linux yet, but free player yes, can be downloaded from Wolfram
research.  

regards,
--Nasser



  reply	other threads:[~2012-06-25 18:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-23 12:02 questions on using the array component iterator for 2012 Nasser M. Abbasi
2012-06-23 12:04 ` Nasser M. Abbasi
2012-06-25 18:19 ` Adam Beneschan
2012-06-25 18:53   ` Nasser M. Abbasi [this message]
2012-06-27 23:31 ` Shark8
replies disabled

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