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 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.223.40 with SMTP id qr8mr9651387pbc.0.1340526278275; Sun, 24 Jun 2012 01:24:38 -0700 (PDT) Path: l9ni13745pbj.0!nntp.google.com!news1.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Any easy/build-in construct to extract submatrices from larger matrix? Date: Sun, 24 Jun 2012 10:24:36 +0200 Organization: cbb software GmbH Message-ID: References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: q1gJPV1SC/KP9ydRbYoWiw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-06-24T10:24:36+02:00 List-Id: On Sun, 24 Jun 2012 03:05:37 -0500, Nasser M. Abbasi wrote: > fyi, modern Fortran has a nice facility to do this, called > pack(). It works like this: make up a MASK matrix of same size > as A. For those elements we want removed, put in a logical > .false at that location. This looks like a low-level hack with unpredictable results, because it does not specify the dimensions and the order of the elements for the result matrix. If I implemented indicator functions for matrices, with the thingy is, I would define an abstract type with multiple implementations including a set of indices. A set would be far more effective for sparse matrices than Boolean matrix. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de