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=2.0 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,32d9aa9d79729b31 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.190.104 with SMTP id gp8mr15463458pbc.4.1340684371376; Mon, 25 Jun 2012 21:19:31 -0700 (PDT) Path: l9ni20661pbj.0!nntp.google.com!news2.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.ada Subject: Re: Any easy/build-in construct to extract submatrices from larger matrix? Date: Mon, 25 Jun 2012 23:19:29 -0500 Organization: Aioe.org NNTP Server Message-ID: References: <788af57d-750d-418d-94bb-75c6557e36a9@g4g2000pbn.googlegroups.com> Reply-To: nma@12000.org NNTP-Posting-Host: KdJUrTuvv3Zv/s8pPxNluw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-06-25T23:19:29-05:00 List-Id: On 6/25/2012 9:48 PM, Jerry wrote: > > The reverse operation, composition, is also useful. In Matlab/Octave > (assuming compatible sizes): > C = [A, B] makes A B > and > D = [A; B] makes > A > B > and > [0, 0, 0, A; B, 0, 0, 0] makes > 0 0 0 A > B 0 0 0 > etc. > If you are interested in comparing specifically matrix/vector operations, I have a specific note in my HOWTO cheat sheet just for this topic, it is at node 66: http://12000.org/my_notes/mma_matlab_control/KERNEL/node66.htm side-by-side comparison. I have Matlab, Mathematica, and started to add Fortran. Might add Ada later on, but I am not good in Ada to do that yet. I am not even good in Fortran but I added few examples just to compare the ease). Matlab and Mathematica do make working with matrices and vectors very easy. Since the syntax and functions that are build into them makes it so. They are designed for this type of work. In Mathematica one uses patterns and many build-in functions to do that, while in Matlab it is mostly the nice build-in syntax designed for matrix work. > Which brings me to one of my least favorite Ada features, the use of > () instead of [] for array indices. Talk about a readability killer. Yes. I would have preferred [] for arrays. But this was talked about before many times. The view is that array access can be looked at mathematically as also a function call. When one writes A(3), then this is also a function call that takes 3 as its argument and returns the value at that location. But I myself would prefer [] for indexing and () for 'actual' function call, just so that when I am reading code, [] will remind me I am looking at an array not a function. But too late for Ada to do this change. Already baked in. It is interesting that in Pascal one uses [] for arrays and Ada was based on Pascal. But the original designers for Ada for some reason did not follow Pascal here. too bad. > But I'm sure that's been beat to death many times. (No, it's not > because [] are not part of ASCII.) > > Jerry > --Nasser