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 04:23:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!pc01.webusenet.com!fe10.atl2.webusenet.com.POSTED!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada References: Subject: Re: Slice from a matrix? MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: X-Complaints-To: abuse@usenetserver.com X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly. NNTP-Posting-Date: Fri, 23 May 2003 07:12:34 EDT Date: Fri, 23 May 2003 06:23:23 -0500 Xref: archiver1.google.com comp.lang.ada:37684 Date: 2003-05-23T06:23:23-05:00 List-Id: "Harald Schmidt" 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 > >