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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!u10g2000vbd.googlegroups.com!not-for-mail From: johnscpg@googlemail.com Newsgroups: comp.lang.ada Subject: Re: ANN: miscellaneous Math routines, GPL'd Date: Wed, 13 May 2009 06:43:11 -0700 (PDT) Organization: http://groups.google.com Message-ID: <010053a9-ddf6-4f90-b260-84d0bcb955d5@u10g2000vbd.googlegroups.com> References: <9dbcdcd0-3c15-4165-9336-3d5778df2ca3@e20g2000vbc.googlegroups.com> <7f7fcafe-189e-423e-a24d-5933bfd6f754@n7g2000prc.googlegroups.com> <46c1db7c-e6b4-48a1-9a4a-a777a1baaf60@r13g2000vbr.googlegroups.com> <5f730696-4657-489f-a89b-518b49194f62@n4g2000vba.googlegroups.com> NNTP-Posting-Host: 143.117.23.126 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1242222191 30308 127.0.0.1 (13 May 2009 13:43:11 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 13 May 2009 13:43:11 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u10g2000vbd.googlegroups.com; posting-host=143.117.23.126; posting-account=Jzt5lQoAAAB4PhTgRLOPGuTLd_K1LY-C User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-GB; rv:1.9.0.9) Gecko/2009050519 Iceweasel/3.0.6 (Debian-3.0.6-1),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:5809 Date: 2009-05-13T06:43:11-07:00 List-Id: On May 13, 12:52=A0pm, gautier_niou...@hotmail.com wrote: > On 13 Mai, 11:25, johns...@googlemail.com wrote: > > > > > Another irritation: =A0suppose user declares > > > =A0 V : Vector (1..10); > > =A0 M : Matrix (0..9, 0..9); > > or worse > > =A0 M : Matrix (0..9, 2..11); > > or worse still > > =A0 M : Matrix (0..11, 2..11); > > > How do you handle it? > > 1. shift indices during iteration inside loops in the lin alg program. > > 2. slide arrays so indices coincide. > > 3. Raise constraint_error; > > 4. Assume they won't do it. > > > I do 3. (See for example procedure Choleski_Decompose at end of > > Disorderly-Random-Deviates.adb =A0and near bottom of > > Disorderly-Random-Deviates.ads.) =A0 But I'm not sure what to do. > > (I was going ask here on comp.lang.ada, but got lazy.) > > Generics with constrained arrays work ok for me here. > > It's done here:http://www.cs.umbc.edu/~squire/adaclass/gnatmath95, > generic_real_linear_equations.ads . > > For using with Ada 2005's matrices, all you need is to replace > package Generic_Real_Arrays by Ada.Numerics.Generic_Real_Arrays > :-) > _________________________________________________________ > Gautier's Ada programming --http://sf.net/users/gdemont/ > > NB: For a direct answer, e-mail address on the Web site! Thanks Gautier! After a quick inspection, I notice a lot of method 1, (shifting indices inside loops), but sometimes the author copies the entire input array over to a new local array with the desired indices (usually 1..N). Also raises an exception if there's a length mismatch. cheers, jonathan