From: Simon Wright on
... at http://sourceforge.net/projects/gnat-math-extn/.

The most obvious change is that there's a set of AUnit tests.

More subtly, the function Eigenvalues now follows the requirement "The
index range of the result is A'Range(1)." in its parent package
(http://www.adaic.com/standards/05rm/html/RM-G-3-2.html).
From: Ada novice on
On Aug 10, 11:38 pm, Simon Wright <si...(a)pushface.org> wrote:
> .. athttp://sourceforge.net/projects/gnat-math-extn/.
>
> The most obvious change is that there's a set of AUnit tests.

Thanks. This will give me an opportunity to "play" with AUnit testing.

YC
From: Simon Wright on
I was thinking about the next release, and contemplating

-- Obtain the eigenvalues of a non-symmetric real matrix.
function Eigenvalues (A : Real_Matrix) return Complex_Vector;

It's easy enough to implement this in
Ada.Numerics.Generic_Complex_Arrays.Extensions, but it seems slightly
more natural to put it into Ada.Numerics.Generic_Real_Arrays.Extensions.

However, I'm puzzled about how to get Complex_Vector in there, because
it's declared in Generic_Complex_Arrays (and of course you'd want to use
the same instantiation throughout, not a local one).

Starting from the declaration of Generic_Complex_Arrays, I arrived at

with Ada.Numerics.Generic_Complex_Arrays;
with Ada.Numerics.Generic_Complex_Types;

generic
with package Complex_Types is new Ada.Numerics.Generic_Complex_Types
(Real);
with package Complex_Arrays is new Ada.Numerics.Generic_Complex_Arrays
(Generic_Real_Arrays, Complex_Types); -- <<<<<<<<<<<<<<<<<<
use Complex_Arrays;
package Ada.Numerics.Generic_Real_Arrays.Extensions is

function Eigenvalues (A : Real_Matrix) return Complex_Vector;

end Ada.Numerics.Generic_Real_Arrays.Extensions;

but GNAT complains about Generic_Real_Arrays where I've indicated,
saying it expects a package instance to instantiate a formal.

I'd been hoping that -- in the context of a child of
Generic_Real_Arrays -- the name would mean 'the current instantiation',
but clearly not (GNAT GPL 2010, GCC 4.5.0).

Any thoughts?
From: Dmitry A. Kazakov on
On Wed, 11 Aug 2010 22:38:46 +0100, Simon Wright wrote:

> I was thinking about the next release, and contemplating
>
> -- Obtain the eigenvalues of a non-symmetric real matrix.
> function Eigenvalues (A : Real_Matrix) return Complex_Vector;
>
> It's easy enough to implement this in
> Ada.Numerics.Generic_Complex_Arrays.Extensions, but it seems slightly
> more natural to put it into Ada.Numerics.Generic_Real_Arrays.Extensions.
>
> However, I'm puzzled about how to get Complex_Vector in there, because
> it's declared in Generic_Complex_Arrays (and of course you'd want to use
> the same instantiation throughout, not a local one).
>
> Starting from the declaration of Generic_Complex_Arrays, I arrived at
>
> with Ada.Numerics.Generic_Complex_Arrays;
> with Ada.Numerics.Generic_Complex_Types;
>
> generic
> with package Complex_Types is new Ada.Numerics.Generic_Complex_Types
> (Real);
> with package Complex_Arrays is new Ada.Numerics.Generic_Complex_Arrays
> (Generic_Real_Arrays, Complex_Types); -- <<<<<<<<<<<<<<<<<<
> use Complex_Arrays;
> package Ada.Numerics.Generic_Real_Arrays.Extensions is
>
> function Eigenvalues (A : Real_Matrix) return Complex_Vector;
>
> end Ada.Numerics.Generic_Real_Arrays.Extensions;
>
> but GNAT complains about Generic_Real_Arrays where I've indicated,
> saying it expects a package instance to instantiate a formal.
>
> I'd been hoping that -- in the context of a child of
> Generic_Real_Arrays -- the name would mean 'the current instantiation',
> but clearly not (GNAT GPL 2010, GCC 4.5.0).

AFAIK it does not work, I tried something similar before. You cannot name
the parent package instance in the generic child declarations.

> Any thoughts?

(as always the first thought is: what a mess generics are! (:-))

I would not do that. It would only make instantiation tricky.
Generic_Complex_Arrays already has all types involved, so for the end user
it is much simpler when the extension package were its child.

Further I would name it

generic
package Ada.Numerics.Generic_Complex_Arrays.
Generic_Real_Extensions;
^^^^
or Generic_Real_Valued_Extensions;
^^^^^

It is always helpful to keep all name spaces clean of generic names.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
From: Stephen Leake on
Simon Wright <simon(a)pushface.org> writes:

> Starting from the declaration of Generic_Complex_Arrays, I arrived at
>
> with Ada.Numerics.Generic_Complex_Arrays;
> with Ada.Numerics.Generic_Complex_Types;
>
> generic
> with package Complex_Types is new Ada.Numerics.Generic_Complex_Types
> (Real);
> with package Complex_Arrays is new Ada.Numerics.Generic_Complex_Arrays
> (Generic_Real_Arrays, Complex_Types); -- <<<<<<<<<<<<<<<<<<
> use Complex_Arrays;
> package Ada.Numerics.Generic_Real_Arrays.Extensions is
>
> function Eigenvalues (A : Real_Matrix) return Complex_Vector;
>
> end Ada.Numerics.Generic_Real_Arrays.Extensions;
>
> but GNAT complains about Generic_Real_Arrays where I've indicated,
> saying it expects a package instance to instantiate a formal.

What is the actual error message? this idiom works for me in SAL:

generic
with package Elementary is new Ada.Numerics.Generic_Elementary_Functions (Real_Type);
with package Math_Scalar is new SAL.Gen_Math.Gen_Scalar (Elementary);
package SAL.Gen_Math.Gen_DOF_3 is


> I'd been hoping that -- in the context of a child of
> Generic_Real_Arrays -- the name would mean 'the current instantiation',
> but clearly not (GNAT GPL 2010, GCC 4.5.0).

Post complete code, I'll try it on my version of gnat.

--
-- Stephe