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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71aa8acfc8368f1c X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: BLAS Date: 2000/05/12 Message-ID: #1/1 X-Deja-AN: 622643458 Content-Transfer-Encoding: 8bit References: To: comp.lang.ada@ada.eu.org Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: usenet@enst.fr X-Trace: menuisier.enst.fr 958154335 7128 137.194.161.2 (12 May 2000 17:58:55 GMT) Organization: ENST, France X-BeenThere: comp.lang.ada@ada.eu.org Mime-Version: 1.0 Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Date: 12 May 2000 17:58:55 GMT Newsgroups: comp.lang.ada Date: 2000-05-12T17:58:55+00:00 List-Id: Duncan wrote: > Ada_Blas <- non generic package defining exceptions and other common stuff Why not plain BLAS? I mean, one doesn't normally put "Ada_" at the front of everything written in Ada. > generic > type Float_Type is digits <>; > type Matrix is array (Integer range <>, Integer range <>) of Float_Type'Base; > > is rejected by GNAT. On what grounds? It looks legal to me... >...I would like to do > > generic > type Float_Type is digits <>; > type Base_Type is new Float_Type'Base; > type Matrix is array (Integer range <>, Integer range <>) of Base_Type; I don't see why you want two float types. Or is this just a workaround for the previous thing? > but there are two problems with this: > (1) GNAT seems to have a bug in this area. > (2) Base_Type could have a range restriction. Eg if I defined > type Base is new Float_Type'Base range 0.0 .. 1.0; > then this is fine for passing as the Base_Type parameter. The > problem is that the Fortran procedures aren't going to respect the > range constraints, so after performing operations you may obtain > vectors/matrices with invalid components. You could then check > (with the 'Valid attribute) if all components are ok, but this > would introduce heavy overheads. I don't see why you need 'Valid. If there's a violation of a constraint, it will raise an exception -- it doesn't matter if it's inside a generic. Or do I misunderstand what you're saying? By the way, you could insist that the instance pass in an unconstrained subtype. You could assert in the body that Float_Type'Base'First = Float_Type'First, and similarly for 'Last. >... Not checking is not in keeping > with the Ada philosophy! By the way, I want Float_Type'Base because > it has no range constraints (cf Ada.Numerics.Generic_Elementary_Functions). Makes sense. Maybe you're better off exporting the Matrix type, after all. Hmm. - Bob