comp.lang.ada
 help / color / mirror / Atom feed
From: "Robert I. Eachus" <rieachus@attbi.com>
Subject: Re: Slice from a matrix?
Date: Sat, 24 May 2003 23:00:06 GMT
Date: 2003-05-24T23:00:06+00:00	[thread overview]
Message-ID: <3ECFF962.5020703@attbi.com> (raw)
In-Reply-To: H1qza.991356$S_4.1007300@rwcrnsc53

P S Norby wrote:

> The trouble then is that you can either have rows of columns, in which case
> you can take a slice of a column, but not a slice of a row... or you can
> have columns of rows, in which case you can take a slice of a row, but not a
> slice of a  column.  The col_vector and row_vector are not subtypes of
> matrix_type.

Not that I would ever throw this at a compiler  but this is not true.

Let's define three types, a "conventional" Ada two-dimensional array, a 
derived type from that type which uses Fortran (row major) layout. 
Finally a vector of vectors type that can be sliced, and which can be 
mapped to the other two types using Unchecked_Conversion.

Will it work in GNAT?  I think so.

Do I think it is a good idea?  Hell no.

I'd much rather define Row and Column functions for the two dimensional 
array type.  Three or four lines of code each, and a good optimizer 
might figure out to actually return a fat pointer to the slice for the 
Row operation.






  reply	other threads:[~2003-05-24 23:00 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 [this message]
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