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.98.59.207 with SMTP id w76mr1445398pfj.40.1504997284367; Sat, 09 Sep 2017 15:48:04 -0700 (PDT) X-Received: by 10.36.250.140 with SMTP id v134mr354081ith.0.1504997284220; Sat, 09 Sep 2017 15:48:04 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!paganini.bofh.team!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!127no1448716itw.0!news-out.google.com!p6ni3077itp.0!nntp.google.com!127no1448713itw.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 9 Sep 2017 15:48:03 -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:48:04 +0000 Content-Type: text/plain; charset="UTF-8" Xref: news.eternal-september.org comp.lang.ada:48003 Date: 2017-09-09T15:48:03-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 One more link I forgot to add in my previous e-mail: https://www.inf.ethz.ch/personal/felixf/pdfs/2006_ArrayStructuredOT.pdf