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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a02:694f:: with SMTP id e76mr24073768jac.111.1556377514116; Sat, 27 Apr 2019 08:05:14 -0700 (PDT) X-Received: by 2002:a54:4f15:: with SMTP id e21mr10378540oiy.122.1556377513691; Sat, 27 Apr 2019 08:05:13 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.linkpendium.com!news.linkpendium.com!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!b2no352496itd.0!news-out.google.com!w17ni301itb.0!nntp.google.com!b2no352492itd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 27 Apr 2019 08:05:13 -0700 (PDT) In-Reply-To: <4b46fe61-45af-4700-967c-503a4dafcee5@googlegroups.com> 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: <41f93c9a-d162-49a6-88ad-fd2bf808432d@googlegroups.com> Subject: Re: matrix manipulation From: mockturtle Injection-Date: Sat, 27 Apr 2019 15:05:14 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:56197 Date: 2019-04-27T08:05:13-07:00 List-Id: On Saturday, April 27, 2019 at 4:50:13 PM UTC+2, hn...@yahoo.de wrote: > Hi, >=20 > I would like to solve the following Ada-Programming demand: >=20 > bk :=3D3; Dv :=3D 4; >=20 > H : Real_Matrix(1..bk*Dv,1..bk*Dv); >=20 > type Block_Matrix > is array (Positive range <>, Positive range <>) of Real_Matrix(1..Dv,1= ..Dv); >=20 > HB : Block_Matrix(1..bk,1..bk); >=20 > Now, there are 12 Block_Matrices which make up H. After calculation of al= l HB's I want to place them into H and ended up in coding of 8 different fo= r loops. Is there a more elegant solution? I noticed that slicing would onl= y work with a definition of linear arrays of a linear array, which does not= fit for the rest of my program. Why 8? I would say 4: two to select the block and two to select the elemen= t inside the block. You could use just 2: iterate over the rows and column= s of H and compute (using mod and division) the block where the element of = H goes.