1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT RUN-TIME COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- S Y S T E M . G E N E R I C _ C O M P L E X _ 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 |
|
|
------------------------------------------------------------------------------
|
31 |
|
|
|
32 |
|
|
-- Package comment required ???
|
33 |
|
|
|
34 |
|
|
with Ada.Numerics.Generic_Complex_Types;
|
35 |
|
|
|
36 |
|
|
generic
|
37 |
|
|
type Real is digits <>;
|
38 |
|
|
with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real);
|
39 |
|
|
use Complex_Types;
|
40 |
|
|
|
41 |
|
|
type Complex_Vector is array (Integer range <>) of Complex;
|
42 |
|
|
type Complex_Matrix is array (Integer range <>, Integer range <>)
|
43 |
|
|
of Complex;
|
44 |
|
|
package System.Generic_Complex_BLAS is
|
45 |
|
|
pragma Pure;
|
46 |
|
|
|
47 |
|
|
-- Although BLAS support is only available for IEEE single and double
|
48 |
|
|
-- compatible floating-point types, this unit will accept any type
|
49 |
|
|
-- and apply conversions as necessary, with possible loss of
|
50 |
|
|
-- precision and range.
|
51 |
|
|
|
52 |
|
|
No_Trans : aliased constant Character := 'N';
|
53 |
|
|
Trans : aliased constant Character := 'T';
|
54 |
|
|
Conj_Trans : aliased constant Character := 'C';
|
55 |
|
|
|
56 |
|
|
-- BLAS Level 1 Subprograms and Types
|
57 |
|
|
|
58 |
|
|
function dot
|
59 |
|
|
(N : Positive;
|
60 |
|
|
X : Complex_Vector;
|
61 |
|
|
Inc_X : Integer := 1;
|
62 |
|
|
Y : Complex_Vector;
|
63 |
|
|
Inc_Y : Integer := 1) return Complex;
|
64 |
|
|
|
65 |
|
|
function nrm2
|
66 |
|
|
(N : Natural;
|
67 |
|
|
X : Complex_Vector;
|
68 |
|
|
Inc_X : Integer := 1) return Real;
|
69 |
|
|
|
70 |
|
|
procedure gemv
|
71 |
|
|
(Trans : access constant Character;
|
72 |
|
|
M : Natural := 0;
|
73 |
|
|
N : Natural := 0;
|
74 |
|
|
Alpha : Complex := (1.0, 0.0);
|
75 |
|
|
A : Complex_Matrix;
|
76 |
|
|
Ld_A : Positive;
|
77 |
|
|
X : Complex_Vector;
|
78 |
|
|
Inc_X : Integer := 1; -- must be non-zero
|
79 |
|
|
Beta : Complex := (0.0, 0.0);
|
80 |
|
|
Y : in out Complex_Vector;
|
81 |
|
|
Inc_Y : Integer := 1); -- must be non-zero
|
82 |
|
|
|
83 |
|
|
-- BLAS Level 3
|
84 |
|
|
|
85 |
|
|
-- gemm s, d, c, z Matrix-matrix product of general matrices
|
86 |
|
|
|
87 |
|
|
procedure gemm
|
88 |
|
|
(Trans_A : access constant Character;
|
89 |
|
|
Trans_B : access constant Character;
|
90 |
|
|
M : Positive;
|
91 |
|
|
N : Positive;
|
92 |
|
|
K : Positive;
|
93 |
|
|
Alpha : Complex := (1.0, 0.0);
|
94 |
|
|
A : Complex_Matrix;
|
95 |
|
|
Ld_A : Integer;
|
96 |
|
|
B : Complex_Matrix;
|
97 |
|
|
Ld_B : Integer;
|
98 |
|
|
Beta : Complex := (0.0, 0.0);
|
99 |
|
|
C : in out Complex_Matrix;
|
100 |
|
|
Ld_C : Integer);
|
101 |
|
|
|
102 |
|
|
end System.Generic_Complex_BLAS;
|