comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
To: comp.lang.ada@ada.eu.org
Subject: Re: BLAS
Date: 2000/05/12
Date: 2000-05-12T17:58:55+00:00	[thread overview]
Message-ID: <wcc3dnn66ab.fsf@world.std.com> (raw)
In-Reply-To: E12qHFV-00005Z-00@Baldrick

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








  parent reply	other threads:[~2000-05-12  0:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <391BC1F5.DFB47045@maths.unine.ch>
2000-05-12  0:00 ` BLAS Duncan Sands
2000-05-12  0:00   ` BLAS Gautier
2000-05-12  0:00   ` Robert A Duff [this message]
2000-05-13  0:00   ` BLAS Larry Kilgallen
2000-05-14  0:00     ` BLAS Gautier
2000-05-15  0:00       ` BLAS Larry Kilgallen
2000-05-15  0:00         ` BLAS Gisle S�lensminde
2000-05-15  0:00       ` BLAS Gisle S�lensminde
2000-05-13  0:00   ` BLAS Robert Dewar
2000-05-12  0:00 BLAS Duncan Sands
2000-05-12  0:00 ` BLAS Gautier
  -- strict thread matches above, loose matches on Subject: below --
2000-05-15  0:00 BLAS Duncan Sands
2000-05-15  0:00 ` BLAS Robert A Duff
2000-05-15  0:00   ` BLAS Robert Dewar
2000-05-16  0:00     ` BLAS Robert A Duff
2000-05-17  0:00       ` BLAS Robert Dewar
2000-05-17  0:00         ` BLAS Robert A Duff
2000-05-18  0:00           ` BLAS Robert Dewar
replies disabled

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