comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <sb463ba@d2-hrz.uni-duisburg.de>
Subject: Re: Slice from a matrix?
Date: Fri, 23 May 2003 18:13:26 +0000 (UTC)
Date: 2003-05-23T18:13:26+00:00	[thread overview]
Message-ID: <baloc6$b0d$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: Cmnza.38775$l66.3829@fe10.atl2.webusenet.com

David C. Hoos <david.c.hoos.sr@ada95.com> wrote:
: "Harald Schmidt" <harald.schmidt@anobject.net> wrote in message
:>   [...]
:> Package matrix is
:>     type vector_type is array (positive range <>) of item_type;
:>     type matrix_type is array (positive range <>,
:>                                positive range <>) of item_type;
:>     subtype col_vector is vector_type(1..cols);
:>     subtype row_vector is vector_type(1..rows);
:>     subtype matrix is matrix_type(1..rows, 1..cols);
:> ...
:> End matrix;
:> My question is how to get a slice from a matrix which I can convert to a
:> col_vector which does the printing?
:>

: Since slices in ada can only be taken from one-dimensional arrays, you
: would need to declare your matrix as an array of vectors.
: Individual elements are then accessed by matrix (m}{n}.

Wouldn't this be a good opportunity to hide the implementation of
both vector_type and matrix_type, declare the needed subprograms
in the matrix spec, and use whatever combination of data "layout"
and algorithms seem appropriate to implement access to columns,
rows, and cells?



  parent reply	other threads:[~2003-05-23 18:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-23  9:14 Slice from a matrix? Harald Schmidt
2003-05-23 10:52 ` Dale Stanbrough
2003-05-23 11:23 ` David C. Hoos
2003-05-23 14:15   ` P S Norby
2003-05-24 23:00     ` Robert I. Eachus
2003-05-23 18:13   ` Georg Bauhaus [this message]
2003-05-23 17:56 ` Stephen Leake
2003-05-23 20:03   ` Simon Wright
2003-05-23 21:06     ` Stephen Leake
replies disabled

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