comp.lang.ada
 help / color / mirror / Atom feed
From: johnscpg@googlemail.com
Subject: Re: ANN: miscellaneous Math routines, GPL'd
Date: Wed, 13 May 2009 06:43:11 -0700 (PDT)
Date: 2009-05-13T06:43:11-07:00	[thread overview]
Message-ID: <010053a9-ddf6-4f90-b260-84d0bcb955d5@u10g2000vbd.googlegroups.com> (raw)
In-Reply-To: 5f730696-4657-489f-a89b-518b49194f62@n4g2000vba.googlegroups.com

On May 13, 12:52 pm, gautier_niou...@hotmail.com wrote:
> On 13 Mai, 11:25, johns...@googlemail.com wrote:
>
>
>
> > Another irritation:  suppose user declares
>
> >   V : Vector (1..10);
> >   M : Matrix (0..9, 0..9);
> > or worse
> >   M : Matrix (0..9, 2..11);
> > or worse still
> >   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  and near bottom of
> > Disorderly-Random-Deviates.ads.)   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




      reply	other threads:[~2009-05-13 13:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12 16:38 ANN: miscellaneous Math routines, GPL'd johnscpg
2009-05-12 18:45 ` John B. Matthews
2009-05-13  9:39   ` johnscpg
2009-05-13 13:40     ` John B. Matthews
2009-05-12 19:03 ` Dmitry A. Kazakov
2009-05-12 21:02 ` lanceboyle
2009-05-13  9:25   ` johnscpg
2009-05-13 11:52     ` gautier_niouzes
2009-05-13 13:43       ` johnscpg [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox