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.57.152 with SMTP id u24mr3899041pfj.42.1504676076191; Tue, 05 Sep 2017 22:34:36 -0700 (PDT) X-Received: by 10.36.98.5 with SMTP id d5mr252235itc.13.1504676076039; Tue, 05 Sep 2017 22:34:36 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder4.news.weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!k189no136054itk.0!news-out.google.com!c139ni55itb.0!nntp.google.com!k189no136049itk.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 5 Sep 2017 22:34:35 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=174.17.221.250; posting-account=q4eMrwoAAACLbpawAxhGfyqV3g6H0iOT NNTP-Posting-Host: 174.17.221.250 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1d996595-5b16-4f66-8a50-7dfb1165fb27@googlegroups.com> Subject: Re: how to copy complete column (or row) of matrix to another? From: faryumg@gmail.com Injection-Date: Wed, 06 Sep 2017 05:34:36 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:47944 Date: 2017-09-05T22:34:35-07:00 List-Id: On Tuesday, September 5, 2017 at 4:10:32 PM UTC-7, Nasser M. Abbasi wrote: >=20 > 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. I agree that this is a serious shortcoming of Ada. But like Randy said, you= can have arrays of arrays which probably isn't a great solution if you are= going to do lots of numerical stuff (OK for "computer sciencey" stuff I su= ppose). I think possibly a better solution is to use normal matrices such a= s you defined in your example and you can write just a few little functions= that will do the copying for you; you can make them look fairly readable i= f not quite as nice as Fortran or Matlab. And don't forget that Ada now has= built-in vector and matrix types for real and complex numbers, with overlo= aded operators. You can also write your own overloads so that can do essentially "mixed-mod= e" arithmetic so that you can write mathematical code without considering w= alking into traffic with your eyes closed because of all the type conversio= ns. Or I can send you mine if you like. I've made overloaded operators for = integer, real, imaginary, and complex numbers as well as several array type= s--there are a lot of them but they are easy to write. Ada's strong typing makes e.g. the three ways of vector multiplication inte= resting. I have three "*" operators for vectors and the three kinds of mult= iplication are made unambiguous because of the return type. Consider a :=3D b * c; where b and c are vectors. If a is a scalar, then b * c is the inner or "do= t" product. If a is a vector, then b * c is a element-by-element multiplica= tion. And if a is a matrix, then b * c is the outer product. Pretty neat, h= uh. Jerry