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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: how to copy complete column (or row) of matrix to another? Date: Tue, 5 Sep 2017 18:10:23 -0500 Organization: Aioe.org NNTP Server Message-ID: References: Reply-To: nma@12000.org NNTP-Posting-Host: haGAlPkXY4sPzKA70YuTTA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:47941 Date: 2017-09-05T18:10:23-05:00 List-Id: On 9/5/2017 5:45 PM, Randy Brukardt wrote: > "Nasser M. Abbasi" wrote in message > news:oolo0a$1djr$1@gioia.aioe.org... >> 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? > > No, that's not supported. It would be a distributed overhead to allow (that > is, it would make all 2D operations slower), as the components of a slice > would not necessarily be contiguous. > > In some cases, it makes more sense to declare a 1D array of a 1D array. Then > you can slice the arrays. (That wouldn't make much sense for a true matrix; > that's not something I use much, so most of my types tend to be arrays of > arrays.) > > ... >> 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? > > Yup. (Both statements are true. ;-) > > Randy. > Thank you Randy for the answer. Ok. I understand. But this unfortunately takes Ada out of possible languages to use for me for now. I am planning to take numerical course where we have choice to use Fortran or Matlab or another language, but without being able to do such common operations on matrices, (without writing much more code) I will now look at using Fortran or Matlab for this. Too bad, because Ada is good language in terms of its strong typing and other features, which I think will make numerical software more robust, but it has little support for many common operations build-in for working with matrices and vectors as Fortran and Matlab already has. Someone should design a solid Ada like language but with focus on numerical and computational work. That will be a winner. --Nasser