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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.14.150 with SMTP id 144mr4041602ite.11.1504996418897; Sat, 09 Sep 2017 15:33:38 -0700 (PDT) X-Received: by 10.36.80.78 with SMTP id m75mr363658itb.2.1504996418864; Sat, 09 Sep 2017 15:33:38 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!feed.usenet.farm!feeder4.usenet.farm!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!o200no1445830itg.0!news-out.google.com!c139ni2097itb.0!nntp.google.com!o200no1445825itg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 9 Sep 2017 15:33:38 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=78.8.210.82; posting-account=-iT6ZQoAAAAlqBCInAc-vB6x1soT8Jhq NNTP-Posting-Host: 78.8.210.82 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: how to copy complete column (or row) of matrix to another? From: darek Injection-Date: Sat, 09 Sep 2017 22:33:38 +0000 Content-Type: text/plain; charset="UTF-8" Xref: news.eternal-september.org comp.lang.ada:48002 Date: 2017-09-09T15:33:38-07:00 List-Id: On Tuesday, 5 September 2017 10:41:49 UTC+2, Nasser M. Abbasi wrote: > I have not programmed in Ada for long time. I forgot now if > Ada supports copying whole column or whole row of 2D matrix > in one operation or not? > > Here is a toy example. I want to copy one matrix > to another using a loop (to see if this is allowed) > > -------------------------- > procedure t1 is > type Matrix is array (Integer range <>, Integer range <>) of Integer; > A : Matrix := > (( 1, 2, 3), > ( 4, 5, 6), > ( 7, 8, 9)); > B: Matrix(1..3,1..3); > begin -- copy A to B one row at a time > > FOR I in A'range(1) LOOP > B(I,1..3):=A(I,1..3); -- error at this line > END LOOP; > > end t1; > --------------------- > > I see old thread that slicing is not allowed for matrix? > > https://groups.google.com/forum/#!topic/comp.lang.ada/vwPXMabvUR8 > "Copying rows in a two dimensional array." > > Is this the reason for the error I get or Am I doing something > silly in the above? > > Using gnat 2017 > > thanks > --Nasser It is not Ada but ... Have a look at this article: http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=FF8CA42FE18D109BFC4798DF3BB91926?doi=10.1.1.205.9658&rep=rep1&type=pdf These extensions have been implemented in the ActiveOberon language running under the A2 operating system (which can run natively, under Windows, under Linux). You can get the whole system here: http://www.ocp.inf.ethz.ch/wiki/Development/Repository The user forum is here: http://www.ocp.inf.ethz.ch/forum/ The ActiveOberon language supports COMPLEX/LONGCOMPLEX data types natively. Regards, Darek