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=-0.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLY autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a02:c807:: with SMTP id p7mr22634519jao.38.1556384300791; Sat, 27 Apr 2019 09:58:20 -0700 (PDT) X-Received: by 2002:a9d:5188:: with SMTP id y8mr32480212otg.357.1556384300644; Sat, 27 Apr 2019 09:58:20 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!b2no366872itd.0!news-out.google.com!w17ni313itb.0!nntp.google.com!136no366116itk.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 27 Apr 2019 09:58:20 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=93.41.2.250; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99 NNTP-Posting-Host: 93.41.2.250 References: <4b46fe61-45af-4700-967c-503a4dafcee5@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: matrix manipulation From: mockturtle Injection-Date: Sat, 27 Apr 2019 16:58:20 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 3007 X-Received-Body-CRC: 3129222245 Xref: reader01.eternal-september.org comp.lang.ada:56200 Date: 2019-04-27T09:58:20-07:00 List-Id: On Saturday, April 27, 2019 at 6:37:45 PM UTC+2, J-P. Rosen wrote: > Le 27/04/2019 =C3=A0 17:21, hnptz@yahoo.de a =C3=A9crit : > > The mod solution sounds interesting. I then might switch to indices > > starting with zero, which may be easier to handle in connection with > > the mod function. >=20 > It just means that you'll end up doing by hand the index calculation > that the compiler would do for you with nested loops. Correct me if I am wrong, but it seems to me that you would end to do some = calculation anyway * If you iterate over rows and column of the full matrix (that is, the non-= block matrix) you need to compute block position and position inside the bl= ock with mod/division. This requires two loops * If you iterate over blocks and row/column inside the block you need to co= mpute the corresponding position inside the full matrix. This requires 4 l= oops * To be honest, I cannot imagine how you would use 6 loops: the 2 indexes = used by the full matrix are in bijective correspondence with the 4 indexes = used by the block matrix, therefore you loop over one matrix and compute th= e position in the other. I guess it is more or less a matter of taste and readability. Personally, I= would _slightly_ prefer the 2-loop solution because I do not like too many= nested loops. >=20 > Replacing multiple loops with a single loop buys you nothing as long as > the total number of iterations is the same... > --=20 > J-P. Rosen > Adalog > 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX > Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 > http://www.adalog.fr