File : ada_blas.ads


-------------------------------------------------------------------------------
-- Copyright (C) 2000-2001 Centre National de la Recherche Scientifique      --
--                                                                           --
-- This program is free software; you can redistribute it and/or modify      --
-- it under the terms of the GNU General Public License as published by      --
-- the Free Software Foundation; either version 2 of the License, or         --
-- (at your option) any later version.                                       --
-- As a special exception, if other files instantiate generics from this     --
-- unit, or you link this unit with other files to produce an executable,    --
-- this unit does not by itself cause the resulting executable to be         --
-- covered by the GNU General Public License. This exception does not        --
-- however invalidate any other reasons why the executable file might be     --
-- covered by the GNU Public License.                                        --
--                                                                           --
-- This program is distributed in the hope that it will be useful,           --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of            --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             --
-- GNU General Public License for more details.                              --
--                                                                           --
-- You should have received a copy of the GNU General Public License         --
-- along with this program; if not, write to the Free Software               --
-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA --
--                                                                           --
--  Author: Duncan Sands (Duncan.Sands@math.u-psud.fr)                       --
--          Departement de Mathematiques, Batiment 425,                      --
--          Universite de Paris-XI, Orsay, France.                           --
--          http://topo.math.u-psud.fr/~sands                                --
-------------------------------------------------------------------------------

--  Binding to the BLAS

--  This package provides definitions used by both the real and complex BLAS.
--  You may need to modify Name_Prepend and Name_Append to suit your system.

with Interfaces.Fortran;

package Ada_BLAS is
   pragma Pure (Ada_BLAS);

   Argument_Error, Unsupported_Precision_Error : exception;
   
   type Precision_Type is (
     Single,     -- Fortran REAL
     Double,     -- Fortran DOUBLE PRECISION
     Unsupported -- Not a standard Fortran precision
   );

   type Diagonal_Type is ( -- For triangular matrices:
     Non_Unit_Triangular,  -- Do not assume all diagonal elements equal 1
     Unit_Triangular       -- Assume all diagonal elements equal 1
   );
   
   type Side_Type is (
     Left, -- A or op(A) on the left
     Right -- A or op(A) on the right
   );
   
   type Transpose_Type is (
     None,               -- use X
     Transpose,          -- use X^T
     Conjugate_Transpose -- use X^H
   );
   
   type Triangle_Type is (
     Upper_Triangle, -- Only upper triangle is referenced / upper triangular
     Lower_Triangle  -- Only lower triangle is referenced / lower triangular
   );
private
   --  Strings that will be appended/prepended to each BLAS subroutine name
   --  to form the external name used when importing it.
   --  They may need to be modified for your system
   Name_Prepend : constant String := "";
   Name_Append  : constant String := "_";

   use Interfaces.Fortran;

   Fortran_DIAG : constant array (Diagonal_Type) of Character_Set := (
     Non_Unit_Triangular => 'N',
     Unit_Triangular     => 'U'
   );

   Fortran_SIDE : constant array (Side_Type) of Character_Set := (
     Left  => 'L',
     Right => 'R'
   );

   Fortran_TRANS : constant array (Transpose_Type) of Character_Set := (
     None                => 'N',
     Transpose           => 'T',
     Conjugate_Transpose => 'C'
   );

   Fortran_UPLO : constant array (Triangle_Type) of Character_Set := (
     Upper_Triangle => 'U',
     Lower_Triangle => 'L'
   );
end Ada_BLAS;