comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Any easy/build-in construct to extract submatrices from larger matrix?
Date: Tue, 26 Jun 2012 13:44:23 +0200
Date: 2012-06-26T13:44:25+02:00	[thread overview]
Message-ID: <4fe9a099$0$6567$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <js9od2$1m0$1@speranza.aioe.org>

On 25.06.12 15:17, Nasser M. Abbasi wrote:
> On 6/25/2012 3:36 AM, Georg Bauhaus wrote:
>> On 25.06.12 08:32, Nasser M. Abbasi wrote:
>>>
>>> In Mathematica for example, I do this whole operation in one line:
>>>
>>> ---------------------------
>>> Table[ReplacePart[A,{{i},{i,_},{_,j}}:>Sequence[]],{i,nRow},{j,nCol}];
>>> ---------------------------
>>>
>>> That is all. This generates all submatrices from A as needed
>>> in this problem :)
>>
> 
>> What if, as is usually the case, you'd have "primitive" array routines
>> like Pick, Take, Drop, Transpose, and then (this is what it looks
>> like here) implement the removals at i, j like like this:
>>
>>      Shrunk := Transpose (Drop (i, Transpose (Drop (j, Matrix))));
>>
> 
> Yes, that would help. Transpose is there already in Ada. (good).
> Drop? I did not find this. googled for it. I assume this is just
> an example then.

It is fairly easy to write, indeed. Nevertheless, I believe that
such operations should be a little higher level than Fortran's pack.
The latter seems good for implementing the operations, provided
the language allows (re-)attaching dimensions to a lump of data.
I am not sure that Ada's index type based array indexing
is the best model for such flexibility at all levels.
It certainly does not seem strictly necessary to implement some
"primitive" operations.

Nevertheless, Iverson's A Programming Language, and more specifically,
introductory work based on it (things that I can hope to understand in finite
time :), and language work based on it (APL, J, possibly S and R),
reveal a good set of "primitive" operations on arrays, functional style.
Some of these are in Ada already, for example, array concatenation "&",
and (some) indexing. Some can be built using a container/iterator
approach, I think, for example, applying a function to all elements,
either updating the array, or producing a new one. There are simpler
ways to do that, though, even in Ada 83, but they may be a little
less flexible for STL style algorithm work. Just a guess.

Array operations are again interesting for automatic parallelism in
the small, now that consumer hardware has a small array of vector
hardware.



  reply	other threads:[~2012-06-26 11:44 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-24  8:05 Any easy/build-in construct to extract submatrices from larger matrix? Nasser M. Abbasi
2012-06-24  8:24 ` Dmitry A. Kazakov
2012-06-24  8:55   ` Nasser M. Abbasi
2012-06-24 11:10     ` Dmitry A. Kazakov
2012-06-24 12:16       ` Nasser M. Abbasi
2012-06-24 16:11         ` Dmitry A. Kazakov
2012-06-24 17:14           ` Nasser M. Abbasi
2012-06-24 18:33             ` Dmitry A. Kazakov
2012-06-25  5:44             ` J-P. Rosen
2012-06-25  6:32               ` Nasser M. Abbasi
2012-06-25  7:54                 ` J-P. Rosen
2012-06-25  8:20                   ` Dmitry A. Kazakov
2012-06-25 14:21                   ` Nasser M. Abbasi
2012-06-25  8:36                 ` Georg Bauhaus
2012-06-25 13:17                   ` Nasser M. Abbasi
2012-06-26 11:44                     ` Georg Bauhaus [this message]
2012-06-25 16:49                 ` Pascal Obry
2012-06-25 17:36                   ` Nasser M. Abbasi
2012-06-25 18:49                     ` stefan-lucks
2012-06-26  4:41                       ` Nasser M. Abbasi
2012-06-26  7:15                 ` Jacob Sparre Andersen
2012-06-26  9:51                   ` Nasser M. Abbasi
2012-06-25  9:33               ` Simon Wright
2012-06-26  2:48 ` Jerry
2012-06-26  4:19   ` Nasser M. Abbasi
2012-06-26  7:06   ` Nasser M. Abbasi
2012-06-26 12:54     ` Robert A Duff
2012-06-26 15:19       ` Adam Beneschan
2012-06-26 21:14         ` Robert A Duff
2012-06-27 23:42     ` Shark8
2012-06-26  7:10   ` Dmitry A. Kazakov
2012-06-26 15:06   ` Adam Beneschan
2012-06-26 21:19     ` Robert A Duff
2012-06-26 21:40       ` Adam Beneschan
2012-07-03  4:22         ` Randy Brukardt
2012-07-03  8:37           ` Dmitry A. Kazakov
2012-07-05  1:33             ` Randy Brukardt
2012-07-05  7:08               ` Dmitry A. Kazakov
2012-07-06 23:47                 ` Randy Brukardt
2012-07-07  8:22                   ` Dmitry A. Kazakov
2012-07-05 18:56               ` Adam Beneschan
replies disabled

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