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-23 11:13:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!news0.de.colt.net!news-fra1.dfn.de!news-koe1.dfn.de!RRZ.Uni-Koeln.DE!uni-duisburg.de!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: Slice from a matrix? Date: Fri, 23 May 2003 18:13:26 +0000 (UTC) Organization: GMUGHDU Message-ID: References: NNTP-Posting-Host: d2-hrz.uni-duisburg.de X-Trace: a1-hrz.uni-duisburg.de 1053713606 11277 134.91.1.15 (23 May 2003 18:13:26 GMT) X-Complaints-To: usenet@news.uni-duisburg.de NNTP-Posting-Date: Fri, 23 May 2003 18:13:26 +0000 (UTC) User-Agent: tin/1.5.8-20010221 ("Blue Water") (UNIX) (HP-UX/B.11.00 (9000/831)) Xref: archiver1.google.com comp.lang.ada:37707 Date: 2003-05-23T18:13:26+00:00 List-Id: David C. Hoos wrote: : "Harald Schmidt" 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?