1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- I N T E R F A C E S . F O R T R A N . B L A S --
9 -- Copyright (C) 2006-2009, 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 3, 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. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
30 ------------------------------------------------------------------------------
32 -- This package provides a thin binding to the standard Fortran BLAS library.
33 -- Documentation and a reference BLAS implementation is available from
34 -- ftp://ftp.netlib.org. The main purpose of this package is to facilitate
35 -- implementation of the Ada 2005 Ada.Numerics.Generic_Real_Arrays and
36 -- Ada.Numerics.Generic_Complex_Arrays packages. Bindings to other BLAS
37 -- routines may be added over time.
39 -- As actual linker arguments to link with the BLAS implementation differs
40 -- according to platform and chosen BLAS implementation, the linker arguments
41 -- are given in the body of this package. The body may need to be modified in
42 -- order to link with different BLAS implementations tuned to the specific
45 package Interfaces
.Fortran
.BLAS
is
47 pragma Elaborate_Body
;
49 No_Trans
: aliased constant Character := 'N';
50 Trans
: aliased constant Character := 'T';
51 Conj_Trans
: aliased constant Character := 'C';
55 type Real_Vector
is array (Integer range <>) of Real
;
57 type Complex_Vector
is array (Integer range <>) of Complex
;
59 type Double_Precision_Vector
is array (Integer range <>)
62 type Double_Complex_Vector
is array (Integer range <>) of Double_Complex
;
66 type Real_Matrix
is array (Integer range <>, Integer range <>)
69 type Double_Precision_Matrix
is array (Integer range <>, Integer range <>)
72 type Complex_Matrix
is array (Integer range <>, Integer range <>)
75 type Double_Complex_Matrix
is array (Integer range <>, Integer range <>)
85 Inc_Y
: Integer := 1) return Real
;
89 X
: Double_Precision_Vector
;
91 Y
: Double_Precision_Vector
;
92 Inc_Y
: Integer := 1) return Double_Precision
;
99 Inc_Y
: Integer := 1) return Complex
;
103 X
: Double_Complex_Vector
;
104 Inc_X
: Integer := 1;
105 Y
: Double_Complex_Vector
;
106 Inc_Y
: Integer := 1) return Double_Complex
;
111 Inc_X
: Integer := 1) return Real
;
115 X
: Double_Precision_Vector
;
116 Inc_X
: Integer := 1) return Double_Precision
;
121 Inc_X
: Integer := 1) return Real
;
125 X
: Double_Complex_Vector
;
126 Inc_X
: Integer := 1) return Double_Precision
;
131 (Trans
: access constant Character;
138 Inc_X
: Integer := 1; -- must be non-zero
140 Y
: in out Real_Vector
;
141 Inc_Y
: Integer := 1); -- must be non-zero
144 (Trans
: access constant Character;
147 Alpha
: Double_Precision
:= 1.0;
148 A
: Double_Precision_Matrix
;
150 X
: Double_Precision_Vector
;
151 Inc_X
: Integer := 1; -- must be non-zero
152 Beta
: Double_Precision
:= 0.0;
153 Y
: in out Double_Precision_Vector
;
154 Inc_Y
: Integer := 1); -- must be non-zero
157 (Trans
: access constant Character;
160 Alpha
: Complex
:= (1.0, 1.0);
164 Inc_X
: Integer := 1; -- must be non-zero
165 Beta
: Complex
:= (0.0, 0.0);
166 Y
: in out Complex_Vector
;
167 Inc_Y
: Integer := 1); -- must be non-zero
170 (Trans
: access constant Character;
173 Alpha
: Double_Complex
:= (1.0, 1.0);
174 A
: Double_Complex_Matrix
;
176 X
: Double_Complex_Vector
;
177 Inc_X
: Integer := 1; -- must be non-zero
178 Beta
: Double_Complex
:= (0.0, 0.0);
179 Y
: in out Double_Complex_Vector
;
180 Inc_Y
: Integer := 1); -- must be non-zero
185 (Trans_A
: access constant Character;
186 Trans_B
: access constant Character;
196 C
: in out Real_Matrix
;
200 (Trans_A
: access constant Character;
201 Trans_B
: access constant Character;
205 Alpha
: Double_Precision
:= 1.0;
206 A
: Double_Precision_Matrix
;
208 B
: Double_Precision_Matrix
;
210 Beta
: Double_Precision
:= 0.0;
211 C
: in out Double_Precision_Matrix
;
215 (Trans_A
: access constant Character;
216 Trans_B
: access constant Character;
220 Alpha
: Complex
:= (1.0, 1.0);
225 Beta
: Complex
:= (0.0, 0.0);
226 C
: in out Complex_Matrix
;
230 (Trans_A
: access constant Character;
231 Trans_B
: access constant Character;
235 Alpha
: Double_Complex
:= (1.0, 1.0);
236 A
: Double_Complex_Matrix
;
238 B
: Double_Complex_Matrix
;
240 Beta
: Double_Complex
:= (0.0, 0.0);
241 C
: in out Double_Complex_Matrix
;
245 pragma Import
(Fortran
, cdotu
, "cdotu_");
246 pragma Import
(Fortran
, cgemm
, "cgemm_");
247 pragma Import
(Fortran
, cgemv
, "cgemv_");
248 pragma Import
(Fortran
, ddot
, "ddot_");
249 pragma Import
(Fortran
, dgemm
, "dgemm_");
250 pragma Import
(Fortran
, dgemv
, "dgemv_");
251 pragma Import
(Fortran
, dnrm2
, "dnrm2_");
252 pragma Import
(Fortran
, dznrm2
, "dznrm2_");
253 pragma Import
(Fortran
, scnrm2
, "scnrm2_");
254 pragma Import
(Fortran
, sdot
, "sdot_");
255 pragma Import
(Fortran
, sgemm
, "sgemm_");
256 pragma Import
(Fortran
, sgemv
, "sgemv_");
257 pragma Import
(Fortran
, snrm2
, "snrm2_");
258 pragma Import
(Fortran
, zdotu
, "zdotu_");
259 pragma Import
(Fortran
, zgemm
, "zgemm_");
260 pragma Import
(Fortran
, zgemv
, "zgemv_");
261 end Interfaces
.Fortran
.BLAS
;