comp.lang.ada
 help / color / mirror / Atom feed
From: reinkor <reinkor@gmail.com>
Subject: Re: Assuming optimization? What is best of these code alternatives?
Date: Fri, 12 Sep 2014 01:06:03 -0700 (PDT)
Date: 2014-09-12T01:06:03-07:00	[thread overview]
Message-ID: <10864291-3b56-4c08-af10-15301096e8d5@googlegroups.com> (raw)
In-Reply-To: <luu35p$fkp$1@speranza.aioe.org>

OK, thanks so far. I may have oversimplified in my example.
The expression "i1 + i2" may be replaced by something more complex such
as an ordered set (container). Here is a copy from my "real code" where A and B
are (container) ordered sets. Is it any point to store the result from
the following set operations before entering the loops here ?

         AandB := A and B;
         AmB   := A - B;
         AmC   := A - C;
         BmA   := B - A;  -- obs "set minus" = { x |  x \in B and x not \in A)
         CmA   := C - A;

         for j in pos1.j + 1 .. pos2.j - 1 loop
         for i in pos1.i + 1 .. pos2.i - 1 loop
            Bpos := (i,j) + Br0;
            Cpos := (i,j) + Cr0;
            img2(i,j) := RelInf(i,j,img1,AmB);
            if not Rel(img2(i,j),img2(Bpos.i,Bpos.j)) then
               if (for some E of BmA => Rel(img1(i + E.i,j+E.j),img2(Bpos.i,Bpos.j))) then
                  img2(i,j) := RelInf(i,j,img1,AmC);
                  if not Rel(img2(i,j),img2(Cpos.i,Cpos.j)) then
                     if (for some E of CmA => Rel(img1(i + E.i,j+E.j),img2(Cpos.i,Cpos.j))) then
                        img2(i,j) :=  RelInf(i,j,img1,AandB);
                     else
                        img2(i,j) := img2(Cpos.i,Cpos.j);
                     end if;
                  end if;
               else
                  img2(i,j) :=  img2(Bpos.i,Bpos.j);
               end if;
            end if;
         end loop;
         end loop;


      reply	other threads:[~2014-09-12  8:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0868c42e-ed44-4b36-a929-2bffb338ee34@googlegroups.com>
2014-09-11 13:34 ` Assuming optimization? What is best of these code alternatives? J-P. Rosen
2014-09-11 14:48   ` Adam Beneschan
2014-09-12  4:32   ` Per Sandberg
2014-09-11 14:19 ` gautier_niouzes
2014-09-11 14:49   ` Adam Beneschan
2014-09-11 17:30 ` Jeffrey Carter
2014-09-11 18:12 ` Stefan.Lucks
2014-09-12  6:17 ` anon
2014-09-12  8:06   ` reinkor [this message]
replies disabled

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