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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5c1125c290d9dd14 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!newsfeed.straub-nv.de!news2.arglkargh.de!news.n-ix.net!news.belwue.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: ANN: Ada 2005 Math Extensions, 20100810 release Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <82ocd8m826.fsf@stephe-leake.org> <82sk2ivwa7.fsf@stephe-leake.org> <9b04znr94b2i$.pxsxi24sc9zv.dlg@40tude.net> Date: Sat, 14 Aug 2010 22:48:43 +0200 Message-ID: NNTP-Posting-Date: 14 Aug 2010 22:48:43 CEST NNTP-Posting-Host: 3ba7f5c4.newsspool3.arcor-online.net X-Trace: DXC=`l`1l3M[1od]BlmkiiU@BiMcF=Q^Z^V3h4Fo<]lROoRa8kF1@A\TYiM3k[6LHn;2LCVn[ On Sat, 14 Aug 2010 20:16:31 +0100, Simon Wright wrote: > "Dmitry A. Kazakov" 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