From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
Subject: Re: Slice from a matrix?
Date: Fri, 23 May 2003 06:23:23 -0500
Date: 2003-05-23T06:23:23-05:00 [thread overview]
Message-ID: <Cmnza.38775$l66.3829@fe10.atl2.webusenet.com> (raw)
In-Reply-To: BAF3B30D.3023%harald.schmidt@anobject.net
"Harald Schmidt" <harald.schmidt@anobject.net> wrote in message
news:BAF3B30D.3023%harald.schmidt@anobject.net...
> Hi,
>
> I got a generic matrix / vector package like this:
>
> Generic
> rows : positive;
> cols : positive;
> item_type is digits <>;
> 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;
>
> Then I have three Put procedures, one for matrix, one for row_vector, and
> one for col_vector.
>
> My question is how to get a slice from a matrix which I can convert to a
> col_vector which does the printing?
>
> Things like...
>
> PUT (col_vector(M (1, 1..3)));
>
> doesn't work.
>
> I don't want to copy code for the printing routines.
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}.
Incidentally, shouldn't a vector which is indexed by row be a column vector,
and a vector which is indexed by column be a row vector?
>
> Thanks for any help,
>
> Harald
>
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>
>
next prev parent reply other threads:[~2003-05-23 11:23 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 [this message]
2003-05-23 14:15 ` P S Norby
2003-05-24 23:00 ` Robert I. Eachus
2003-05-23 18:13 ` Georg Bauhaus
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