* gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS): Simplify test for
[official-gcc.git] / gcc / ada / i-forbla.ads
blob3910349a652bf5f98afd049d224d4870913fd7b9
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- I N T E R F A C E S . F O R T R A N . B L A S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2006-2009, Free Software Foundation, Inc. --
10 -- --
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. --
17 -- --
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. --
21 -- --
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/>. --
26 -- --
27 -- GNAT was originally developed by the GNAT team at New York University. --
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
29 -- --
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
43 -- target.
45 package Interfaces.Fortran.BLAS is
46 pragma Pure;
47 pragma Elaborate_Body;
49 No_Trans : aliased constant Character := 'N';
50 Trans : aliased constant Character := 'T';
51 Conj_Trans : aliased constant Character := 'C';
53 -- Vector types
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 <>)
60 of Double_Precision;
62 type Double_Complex_Vector is array (Integer range <>) of Double_Complex;
64 -- Matrix types
66 type Real_Matrix is array (Integer range <>, Integer range <>)
67 of Real;
69 type Double_Precision_Matrix is array (Integer range <>, Integer range <>)
70 of Double_Precision;
72 type Complex_Matrix is array (Integer range <>, Integer range <>)
73 of Complex;
75 type Double_Complex_Matrix is array (Integer range <>, Integer range <>)
76 of Double_Complex;
78 -- BLAS Level 1
80 function sdot
81 (N : Positive;
82 X : Real_Vector;
83 Inc_X : Integer := 1;
84 Y : Real_Vector;
85 Inc_Y : Integer := 1) return Real;
87 function ddot
88 (N : Positive;
89 X : Double_Precision_Vector;
90 Inc_X : Integer := 1;
91 Y : Double_Precision_Vector;
92 Inc_Y : Integer := 1) return Double_Precision;
94 function cdotu
95 (N : Positive;
96 X : Complex_Vector;
97 Inc_X : Integer := 1;
98 Y : Complex_Vector;
99 Inc_Y : Integer := 1) return Complex;
101 function zdotu
102 (N : Positive;
103 X : Double_Complex_Vector;
104 Inc_X : Integer := 1;
105 Y : Double_Complex_Vector;
106 Inc_Y : Integer := 1) return Double_Complex;
108 function snrm2
109 (N : Natural;
110 X : Real_Vector;
111 Inc_X : Integer := 1) return Real;
113 function dnrm2
114 (N : Natural;
115 X : Double_Precision_Vector;
116 Inc_X : Integer := 1) return Double_Precision;
118 function scnrm2
119 (N : Natural;
120 X : Complex_Vector;
121 Inc_X : Integer := 1) return Real;
123 function dznrm2
124 (N : Natural;
125 X : Double_Complex_Vector;
126 Inc_X : Integer := 1) return Double_Precision;
128 -- BLAS Level 2
130 procedure sgemv
131 (Trans : access constant Character;
132 M : Natural := 0;
133 N : Natural := 0;
134 Alpha : Real := 1.0;
135 A : Real_Matrix;
136 Ld_A : Positive;
137 X : Real_Vector;
138 Inc_X : Integer := 1; -- must be non-zero
139 Beta : Real := 0.0;
140 Y : in out Real_Vector;
141 Inc_Y : Integer := 1); -- must be non-zero
143 procedure dgemv
144 (Trans : access constant Character;
145 M : Natural := 0;
146 N : Natural := 0;
147 Alpha : Double_Precision := 1.0;
148 A : Double_Precision_Matrix;
149 Ld_A : Positive;
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
156 procedure cgemv
157 (Trans : access constant Character;
158 M : Natural := 0;
159 N : Natural := 0;
160 Alpha : Complex := (1.0, 1.0);
161 A : Complex_Matrix;
162 Ld_A : Positive;
163 X : Complex_Vector;
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
169 procedure zgemv
170 (Trans : access constant Character;
171 M : Natural := 0;
172 N : Natural := 0;
173 Alpha : Double_Complex := (1.0, 1.0);
174 A : Double_Complex_Matrix;
175 Ld_A : Positive;
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
182 -- BLAS Level 3
184 procedure sgemm
185 (Trans_A : access constant Character;
186 Trans_B : access constant Character;
187 M : Positive;
188 N : Positive;
189 K : Positive;
190 Alpha : Real := 1.0;
191 A : Real_Matrix;
192 Ld_A : Integer;
193 B : Real_Matrix;
194 Ld_B : Integer;
195 Beta : Real := 0.0;
196 C : in out Real_Matrix;
197 Ld_C : Integer);
199 procedure dgemm
200 (Trans_A : access constant Character;
201 Trans_B : access constant Character;
202 M : Positive;
203 N : Positive;
204 K : Positive;
205 Alpha : Double_Precision := 1.0;
206 A : Double_Precision_Matrix;
207 Ld_A : Integer;
208 B : Double_Precision_Matrix;
209 Ld_B : Integer;
210 Beta : Double_Precision := 0.0;
211 C : in out Double_Precision_Matrix;
212 Ld_C : Integer);
214 procedure cgemm
215 (Trans_A : access constant Character;
216 Trans_B : access constant Character;
217 M : Positive;
218 N : Positive;
219 K : Positive;
220 Alpha : Complex := (1.0, 1.0);
221 A : Complex_Matrix;
222 Ld_A : Integer;
223 B : Complex_Matrix;
224 Ld_B : Integer;
225 Beta : Complex := (0.0, 0.0);
226 C : in out Complex_Matrix;
227 Ld_C : Integer);
229 procedure zgemm
230 (Trans_A : access constant Character;
231 Trans_B : access constant Character;
232 M : Positive;
233 N : Positive;
234 K : Positive;
235 Alpha : Double_Complex := (1.0, 1.0);
236 A : Double_Complex_Matrix;
237 Ld_A : Integer;
238 B : Double_Complex_Matrix;
239 Ld_B : Integer;
240 Beta : Double_Complex := (0.0, 0.0);
241 C : in out Double_Complex_Matrix;
242 Ld_C : Integer);
244 private
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;