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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA 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 Received: by 10.68.219.170 with SMTP id pp10mr12113796pbc.1.1340603100559; Sun, 24 Jun 2012 22:45:00 -0700 (PDT) Path: l9ni17096pbj.0!nntp.google.com!news2.google.com!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Any easy/build-in construct to extract submatrices from larger matrix? Date: Mon, 25 Jun 2012 07:44:59 +0200 Organization: A noiseless patient Spider Message-ID: References: <1xzo3825h9yt7$.45flobqwlel6.dlg@40tude.net> Mime-Version: 1.0 Injection-Date: Mon, 25 Jun 2012 05:44:59 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="cJo7kSTQUrCFv2/D8KKtqw"; logging-data="18155"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/U5OlzMG4bx0XchB4R6hy3" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: Cancel-Lock: sha1:bBOZipROJoIzll5Os6icMrcE2jM= X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: 2012-06-25T07:44:59+02:00 List-Id: Le 24/06/2012 19:14, Nasser M. Abbasi a �crit : If you want to avoid "if" in "loop": >> If you want a function which would return a submatrix obtained by >> removing >> the row I and column J: > function Exclude (A : Complex_Matrix; I, J : Integer) return Complex_Matrix is AI, AJ : Integer := A'First (1); begin return B : Complex_Matrix (1..A'Length (1)-1, 1..A'Length (2)-1) do BI := 1; for AI in A'First (1) .. I-1 loop BJ := 1; for AJ in A'First (2) .. J-1 loop B (BI, BJ) := A (AI, AJ); BJ := BJ + 1; end loop; for AJ in J+1 .. A'Last (2) loop B (BI, BJ) := A (AI, AJ); BJ := BJ + 1; end loop; BI := BI + 1; end loop; for AI in I+1 .. A'Last (1) loop BJ := 1; for AJ in A'First (2) .. J-1 loop B (BI, BJ) := A (AI, AJ); BJ := BJ + 1; end loop; for AJ in J+1 .. A'Last (2) loop B (BI, BJ) := A (AI, AJ); BJ := BJ + 1; end loop; BI := BI + 1; end loop; end return; end Exclude; -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr