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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a21dfb63457ea960 X-Google-Attributes: gid103376,public From: johnherro@aol.com (John Herro) Subject: Re: array of matrices Date: 1996/05/04 Message-ID: <4mgpab$ep1@newsbf02.news.aol.com>#1/1 X-Deja-AN: 153041267 sender: root@newsbf02.news.aol.com references: <4metga$2jo@news2.h1.usa.pipeline.com> organization: America Online, Inc. (1-800-827-6364) newsgroups: comp.lang.ada Date: 1996-05-04T00:00:00+00:00 List-Id: boaz@usa.pipeline.com(Boaz Chow) writes: > type Matrix is array (integer range <>, integer range <>) of integer; > Your second method [creating an array of > pointers to type Matirx] looks very good. > But how can I retrive the size (or dimension) > of the matrix? On the matrix pointed to, use the attribute 'Last with a subscript. For example, if we have type Matrix is array(Integer range <>, Integer range <>) of Integer; type Ptr is access Matrix; ... A : array(1 .. N) of Ptr; ... A(1) := new Matrix(1 .. 5, 1 .. 15); A(2) := new Matrix(1 .. 15, 1 .. 7); then the upper bound of the FIRST dimension of the matrix pointed to by A(2) is A(2).all'Last(1), - which is 15, and the upper bound of the SECOND dimension of the matrix pointed to by A(2) is A(2).all'Last(2), - which is 7. Similarly, 'First retrieves the lower bound, so in this example A(2).all'First(1) and A(2).all'First(2) are both 1. For one last example, using A(1) instead of A(2), A(1).all'Last(1) is 5. The .all may be omitted in all of these, so A(1)'Last(1) means A(1).all'Last(1). I hope this helps. - John Herro Software Innovations Technology http://members.aol.com/AdaTutor ftp://members.aol.com/AdaTutor