1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- INTERFACES.FORTRAN.BLAS --
9 -- Copyright (C) 2006-2007, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
22 -- As a special exception, if other files instantiate generics from this --
23 -- unit, or you link this unit with other files to produce an executable, --
24 -- this unit does not by itself cause the resulting executable to be --
25 -- covered by the GNU General Public License. This exception does not --
26 -- however invalidate any other reasons why the executable file might be --
27 -- covered by the GNU Public License. --
29 -- GNAT was originally developed by the GNAT team at New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc. --
32 ------------------------------------------------------------------------------
34 -- This package provides a thin binding to the standard Fortran BLAS library.
35 -- Documentation and a reference BLAS implementation is available from
36 -- ftp://ftp.netlib.org. The main purpose of this package is to facilitate
37 -- implementation of the Ada 2005 Ada.Numerics.Generic_Real_Arrays and
38 -- Ada.Numerics.Generic_Complex_Arrays packages. Bindings to other BLAS
39 -- routines may be added over time.
41 -- As actual linker arguments to link with the BLAS implementation differs
42 -- according to platform and chosen BLAS implementation, the linker arguments
43 -- are given in the body of this package. The body may need to be modified in
44 -- order to link with different BLAS implementations tuned to the specific
47 package Interfaces.Fortran.BLAS is
49 pragma Elaborate_Body;
51 No_Trans : aliased constant Character := 'N';
52 Trans : aliased constant Character := 'T';
53 Conj_Trans : aliased constant Character := 'C';
57 type Real_Vector is array (Integer range <>) of Real;
59 type Complex_Vector is array (Integer range <>) of Complex;
61 type Double_Precision_Vector is array (Integer range <>)
64 type Double_Complex_Vector is array (Integer range <>) of Double_Complex;
68 type Real_Matrix is array (Integer range <>, Integer range <>)
71 type Double_Precision_Matrix is array (Integer range <>, Integer range <>)
74 type Complex_Matrix is array (Integer range <>, Integer range <>)
77 type Double_Complex_Matrix is array (Integer range <>, Integer range <>)
87 Inc_Y : Integer := 1) return Real;
91 X : Double_Precision_Vector;
93 Y : Double_Precision_Vector;
94 Inc_Y : Integer := 1) return Double_Precision;
101 Inc_Y : Integer := 1) return Complex;
105 X : Double_Complex_Vector;
106 Inc_X : Integer := 1;
107 Y : Double_Complex_Vector;
108 Inc_Y : Integer := 1) return Double_Complex;
113 Inc_X : Integer := 1) return Real;
117 X : Double_Precision_Vector;
118 Inc_X : Integer := 1) return Double_Precision;
123 Inc_X : Integer := 1) return Real;
127 X : Double_Complex_Vector;
128 Inc_X : Integer := 1) return Double_Precision;
133 (Trans : access constant Character;
140 Inc_X : Integer := 1; -- must be non-zero
142 Y : in out Real_Vector;
143 Inc_Y : Integer := 1); -- must be non-zero
146 (Trans : access constant Character;
149 Alpha : Double_Precision := 1.0;
150 A : Double_Precision_Matrix;
152 X : Double_Precision_Vector;
153 Inc_X : Integer := 1; -- must be non-zero
154 Beta : Double_Precision := 0.0;
155 Y : in out Double_Precision_Vector;
156 Inc_Y : Integer := 1); -- must be non-zero
159 (Trans : access constant Character;
162 Alpha : Complex := (1.0, 1.0);
166 Inc_X : Integer := 1; -- must be non-zero
167 Beta : Complex := (0.0, 0.0);
168 Y : in out Complex_Vector;
169 Inc_Y : Integer := 1); -- must be non-zero
172 (Trans : access constant Character;
175 Alpha : Double_Complex := (1.0, 1.0);
176 A : Double_Complex_Matrix;
178 X : Double_Complex_Vector;
179 Inc_X : Integer := 1; -- must be non-zero
180 Beta : Double_Complex := (0.0, 0.0);
181 Y : in out Double_Complex_Vector;
182 Inc_Y : Integer := 1); -- must be non-zero
187 (Trans_A : access constant Character;
188 Trans_B : access constant Character;
198 C : in out Real_Matrix;
202 (Trans_A : access constant Character;
203 Trans_B : access constant Character;
207 Alpha : Double_Precision := 1.0;
208 A : Double_Precision_Matrix;
210 B : Double_Precision_Matrix;
212 Beta : Double_Precision := 0.0;
213 C : in out Double_Precision_Matrix;
217 (Trans_A : access constant Character;
218 Trans_B : access constant Character;
222 Alpha : Complex := (1.0, 1.0);
227 Beta : Complex := (0.0, 0.0);
228 C : in out Complex_Matrix;
232 (Trans_A : access constant Character;
233 Trans_B : access constant Character;
237 Alpha : Double_Complex := (1.0, 1.0);
238 A : Double_Complex_Matrix;
240 B : Double_Complex_Matrix;
242 Beta : Double_Complex := (0.0, 0.0);
243 C : in out Double_Complex_Matrix;
247 pragma Import (Fortran, cdotu, "cdotu_");
248 pragma Import (Fortran, cgemm, "cgemm_");
249 pragma Import (Fortran, cgemv, "cgemv_");
250 pragma Import (Fortran, ddot, "ddot_");
251 pragma Import (Fortran, dgemm, "dgemm_");
252 pragma Import (Fortran, dgemv, "dgemv_");
253 pragma Import (Fortran, dnrm2, "dnrm2_");
254 pragma Import (Fortran, dznrm2, "dznrm2_");
255 pragma Import (Fortran, scnrm2, "scnrm2_");
256 pragma Import (Fortran, sdot, "sdot_");
257 pragma Import (Fortran, sgemm, "sgemm_");
258 pragma Import (Fortran, sgemv, "sgemv_");
259 pragma Import (Fortran, snrm2, "snrm2_");
260 pragma Import (Fortran, zdotu, "zdotu_");
261 pragma Import (Fortran, zgemm, "zgemm_");
262 pragma Import (Fortran, zgemv, "zgemv_");
263 end Interfaces.Fortran.BLAS;