From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e9cc8b90e75b064d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-24 16:00:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail Message-ID: <3ECFF962.5020703@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Slice from a matrix? References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1053817206 24.62.164.137 (Sat, 24 May 2003 23:00:06 GMT) NNTP-Posting-Date: Sat, 24 May 2003 23:00:06 GMT Organization: AT&T Broadband Date: Sat, 24 May 2003 23:00:06 GMT Xref: archiver1.google.com comp.lang.ada:37742 Date: 2003-05-24T23:00:06+00:00 List-Id: 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.