comp.lang.ada
 help / color / mirror / Atom feed
From: mockturtle <framefritti@gmail.com>
Subject: Re: matrix manipulation
Date: Sat, 27 Apr 2019 08:05:13 -0700 (PDT)
Date: 2019-04-27T08:05:13-07:00	[thread overview]
Message-ID: <41f93c9a-d162-49a6-88ad-fd2bf808432d@googlegroups.com> (raw)
In-Reply-To: <4b46fe61-45af-4700-967c-503a4dafcee5@googlegroups.com>

On Saturday, April 27, 2019 at 4:50:13 PM UTC+2, hn...@yahoo.de wrote:
> Hi,
> 
> I would like to solve the following Ada-Programming demand:
> 
> bk :=3; Dv := 4;
> 
> H : Real_Matrix(1..bk*Dv,1..bk*Dv);
> 
> type Block_Matrix
>    is array (Positive range <>, Positive range <>) of Real_Matrix(1..Dv,1..Dv);
> 
> HB : Block_Matrix(1..bk,1..bk);
> 
> Now, there are 12 Block_Matrices which make up H. After calculation of all HB's I want to place them into H and ended up in coding of 8 different for loops. Is there a more elegant solution? I noticed that slicing would only 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 element inside the block.  You could use just 2: iterate over the rows and columns of H and compute (using mod and division) the block where the element of H goes.


  reply	other threads:[~2019-04-27 15:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-27 14:50 matrix manipulation hnptz
2019-04-27 15:05 ` mockturtle [this message]
2019-04-27 15:21 ` hnptz
2019-04-27 16:37   ` J-P. Rosen
2019-04-27 16:58     ` mockturtle
2019-04-27 22:45 ` Simon Wright
  -- strict thread matches above, loose matches on Subject: below --
2016-11-12 18:16 hnptz
2016-11-12 19:12 ` Jacob Sparre Andersen
2016-11-12 23:30 ` Stephen Leake
2016-11-14 17:39   ` hnptz
2016-11-15 17:54     ` Stephen Leake
2016-11-15 18:57 ` Robert Eachus
replies disabled

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