From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: ANN: Ada 2005 Math Extensions, 20100810 release
Date: Sat, 14 Aug 2010 22:48:43 +0200
Date: 2010-08-14T22:48:43+02:00 [thread overview]
Message-ID: <cjw5bwms827c.1g19zxd6btyex.dlg@40tude.net> (raw)
In-Reply-To: m2vd7duhrk.fsf@pushface.org
On Sat, 14 Aug 2010 20:16:31 +0100, Simon Wright wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
>
>> On Sat, 14 Aug 2010 17:26:20 +0100, Simon Wright wrote:
>>
>>> Given that, the function taking Complex_Matrix and returning
>>> Complex_Vector has "obviously" to be in a child of
>>> Generic_Complex_Arrays.
>>>
>>> So I thought that the function taking Real_Matrix should be in a child
>>> of Generic_Real_Arrays, in spite of the fact it returns a Complex_Vector.
>>>
>>> Clearly this is not the way Nature intended!
>>
>> Hmm, a complex valued function is complex to me. Consider exp(jwt). The
>> argument is real t, the result is complex. Where does it belong?
>
> I think maybe I'll meet Stephe halfway: Ada.Numerics.Generic_Arrays!
>
> Another problem, of course .. Ada 2017 might implement something in this
> space.
If you don't make it a child you can leave the Ada's name space:
package Linear_Algebra.Generic_Eigenvaues_Problem
or something alike.
Regarding Stephe's proposal, independently on the package name you use, I
would suggest this:
with Ada.Numerics.Generic_Complex_Arrays;
generic
with package Complex_Arrays is
new Ada.Numerics.Generic_Complex_Arrays (<>);
package Whatever is
use Complex_Arrays;
use Complex_Types; -- Complex_Arrays.Complex_Types
use Real_Arrays; -- Complex_Arrays.Real_Arrays
function Eigenvalues (A : Real_Matrix) return Complex_Vector;
end Whatever;
You do not need to pass all chain of Generic_Complex_Arrays' arguments,
instead you pick its parameter. This technique greatly simplifies
instantiations.
BTW, this is exactly the case where you might like to rename Complex_Arrays
and others. These unnatural names xxx_Of! (:-)) I am not sure if renaming
is still actual, but it was necessary before. And I have no idea if that
was because of a compiler or language design bug.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2010-08-14 20:48 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-10 21:38 ANN: Ada 2005 Math Extensions, 20100810 release Simon Wright
2010-08-11 11:40 ` Ada novice
2010-08-11 21:38 ` Simon Wright
2010-08-12 5:57 ` Dmitry A. Kazakov
2010-08-12 19:45 ` Simon Wright
2010-08-13 6:27 ` Dmitry A. Kazakov
2010-08-13 6:54 ` Ludovic Brenta
2010-08-13 13:36 ` Yannick Duchêne (Hibou57)
2010-08-13 7:42 ` Georg Bauhaus
2010-08-13 8:40 ` Dmitry A. Kazakov
2010-08-13 13:41 ` Yannick Duchêne (Hibou57)
2010-08-13 13:57 ` Dmitry A. Kazakov
2010-08-13 13:31 ` Yannick Duchêne (Hibou57)
2010-08-13 13:48 ` Dmitry A. Kazakov
2010-08-13 19:50 ` Simon Wright
2010-08-13 20:17 ` Yannick Duchêne (Hibou57)
2010-08-13 22:04 ` Simon Wright
2010-08-13 22:28 ` Yannick Duchêne (Hibou57)
2010-08-13 22:30 ` Yannick Duchêne (Hibou57)
2010-08-14 16:12 ` Simon Wright
2010-08-14 17:16 ` Dmitry A. Kazakov
2010-08-14 17:34 ` Jeffrey Carter
2010-08-14 19:18 ` Simon Wright
2010-08-14 23:51 ` Georg Bauhaus
2010-08-15 0:57 ` Yannick Duchêne (Hibou57)
2010-08-15 2:27 ` Jeffrey Carter
2010-08-12 10:36 ` Stephen Leake
2010-08-12 12:48 ` sjw
2010-08-14 1:05 ` Stephen Leake
2010-08-14 16:26 ` Simon Wright
2010-08-14 17:24 ` Dmitry A. Kazakov
2010-08-14 19:16 ` Simon Wright
2010-08-14 20:48 ` Dmitry A. Kazakov [this message]
2010-08-14 21:55 ` Simon Wright
2010-08-15 6:14 ` Dmitry A. Kazakov
2010-08-15 17:06 ` Simon Wright
2010-08-15 18:18 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox