summaryrefslogtreecommitdiff
path: root/gcc/ada/a-ngcoar.ads
blob: abffbd1b63638347d9452a380e18538a0b279775 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
------------------------------------------------------------------------------
--                                                                          --
--                         GNAT RUN-TIME COMPONENTS                         --
--                                                                          --
--                   ADA.NUMERICS.GENERIC_COMPLEX_ARRAYS                    --
--                                                                          --
--                                 S p e c                                  --
--                                                                          --
-- This specification is derived from the Ada Reference Manual for use with --
-- GNAT.  In accordance with the copyright of that document, you can freely --
-- copy and modify this specification,  provided that if you redistribute a --
-- modified version,  any changes that you have made are clearly indicated. --
--                                                                          --
------------------------------------------------------------------------------

with Ada.Numerics.Generic_Real_Arrays, Ada.Numerics.Generic_Complex_Types;

generic
   with package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (<>);
   use Real_Arrays;
   with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (Real);
   use Complex_Types;
package Ada.Numerics.Generic_Complex_Arrays is
   pragma Pure (Generic_Complex_Arrays);

   --  Types

   type Complex_Vector is array (Integer range <>) of Complex;
   type Complex_Matrix is
     array (Integer range <>, Integer range <>) of Complex;

   --  Subprograms for Complex_Vector types
   --  Complex_Vector selection, conversion and composition operations

   function Re (X : Complex_Vector) return Real_Vector;
   function Im (X : Complex_Vector) return Real_Vector;

   procedure Set_Re (X : in out Complex_Vector; Re : Real_Vector);
   procedure Set_Im (X : in out Complex_Vector; Im : Real_Vector);

   function Compose_From_Cartesian
     (Re : Real_Vector) return Complex_Vector;
   function Compose_From_Cartesian
     (Re, Im : Real_Vector) return Complex_Vector;

   function Modulus (X : Complex_Vector) return Real_Vector;
   function "abs" (Right : Complex_Vector) return Real_Vector renames Modulus;
   function Argument (X : Complex_Vector) return Real_Vector;

   function Argument
     (X     : Complex_Vector;
      Cycle : Real'Base) return Real_Vector;

   function Compose_From_Polar
     (Modulus, Argument : Real_Vector) return Complex_Vector;

   function Compose_From_Polar
     (Modulus, Argument : Real_Vector;
      Cycle             : Real'Base) return Complex_Vector;

   --  Complex_Vector arithmetic operations

   function "+" (Right : Complex_Vector) return Complex_Vector;
   function "-" (Right : Complex_Vector) return Complex_Vector;
   function Conjugate (X : Complex_Vector) return Complex_Vector;
   function "+" (Left, Right : Complex_Vector) return Complex_Vector;
   function "-" (Left, Right : Complex_Vector) return Complex_Vector;
   function "*" (Left, Right : Complex_Vector) return Complex;
   function "abs" (Right : Complex_Vector) return Complex;

   --  Mixed Real_Vector and Complex_Vector arithmetic operations

   function "+"
     (Left  : Real_Vector;
      Right : Complex_Vector) return Complex_Vector;

   function "+"
     (Left  : Complex_Vector;
      Right : Real_Vector) return Complex_Vector;

   function "-"
     (Left  : Real_Vector;
      Right : Complex_Vector) return Complex_Vector;

   function "-"
     (Left  : Complex_Vector;
      Right : Real_Vector) return Complex_Vector;

   function "*" (Left : Real_Vector; Right : Complex_Vector) return Complex;
   function "*" (Left : Complex_Vector; Right : Real_Vector) return Complex;

   --  Complex_Vector scaling operations

   function "*"
     (Left  : Complex;
      Right : Complex_Vector) return Complex_Vector;

   function "*"
     (Left  : Complex_Vector;
      Right : Complex) return Complex_Vector;

   function "/"
     (Left  : Complex_Vector;
      Right : Complex) return Complex_Vector;

   function "*"
     (Left  : Real'Base;
      Right : Complex_Vector) return Complex_Vector;

   function "*"
     (Left  : Complex_Vector;
      Right : Real'Base) return Complex_Vector;

   function "/"
     (Left  : Complex_Vector;
      Right : Real'Base) return Complex_Vector;

   --  Other Complex_Vector operations

   function Unit_Vector
     (Index : Integer;
      Order : Positive;
      First : Integer := 1) return Complex_Vector;

   --  Subprograms for Complex_Matrix types

   --  Complex_Matrix selection, conversion and composition operations

   function Re (X : Complex_Matrix) return Real_Matrix;
   function Im (X : Complex_Matrix) return Real_Matrix;

   procedure Set_Re (X : in out Complex_Matrix; Re : Real_Matrix);
   procedure Set_Im (X : in out Complex_Matrix; Im : Real_Matrix);

   function Compose_From_Cartesian (Re : Real_Matrix) return Complex_Matrix;

   function Compose_From_Cartesian
     (Re, Im : Real_Matrix) return  Complex_Matrix;

   function Modulus (X : Complex_Matrix) return Real_Matrix;
   function "abs" (Right : Complex_Matrix) return Real_Matrix renames Modulus;

   function Argument (X : Complex_Matrix) return Real_Matrix;

   function Argument
     (X     : Complex_Matrix;
      Cycle : Real'Base) return Real_Matrix;

   function Compose_From_Polar
     (Modulus, Argument : Real_Matrix) return Complex_Matrix;

   function Compose_From_Polar
     (Modulus  : Real_Matrix;
      Argument : Real_Matrix;
      Cycle    : Real'Base) return Complex_Matrix;

   --  Complex_Matrix arithmetic operations

   function "+" (Right : Complex_Matrix) return Complex_Matrix;
   function "-" (Right : Complex_Matrix) return Complex_Matrix;

   function Conjugate (X : Complex_Matrix) return Complex_Matrix;
   function Transpose (X : Complex_Matrix) return Complex_Matrix;

   function "+" (Left, Right : Complex_Matrix) return Complex_Matrix;
   function "-" (Left, Right : Complex_Matrix) return Complex_Matrix;
   function "*" (Left, Right : Complex_Matrix) return Complex_Matrix;
   function "*" (Left, Right : Complex_Vector) return Complex_Matrix;

   function "*"
     (Left  : Complex_Vector;
      Right : Complex_Matrix) return Complex_Vector;

   function "*"
     (Left  : Complex_Matrix;
      Right : Complex_Vector) return Complex_Vector;

   --  Mixed Real_Matrix and Complex_Matrix arithmetic operations

   function "+"
     (Left  : Real_Matrix;
      Right : Complex_Matrix) return Complex_Matrix;

   function "+"
     (Left  : Complex_Matrix;
      Right : Real_Matrix) return Complex_Matrix;

   function "-"
     (Left  : Real_Matrix;
      Right : Complex_Matrix) return Complex_Matrix;

   function "-"
     (Left  : Complex_Matrix;
      Right : Real_Matrix) return Complex_Matrix;

   function "*"
     (Left  : Real_Matrix;
      Right : Complex_Matrix) return Complex_Matrix;

   function "*"
     (Left  : Complex_Matrix;
      Right : Real_Matrix) return Complex_Matrix;

   function "*"
     (Left  : Real_Vector;
      Right : Complex_Vector) return Complex_Matrix;

   function "*"
     (Left  : Complex_Vector;
      Right : Real_Vector) return Complex_Matrix;

   function "*"
     (Left  : Real_Vector;
      Right : Complex_Matrix) return Complex_Vector;

   function "*"
     (Left  : Complex_Vector;
      Right : Real_Matrix) return Complex_Vector;

   function "*"
     (Left  : Real_Matrix;
      Right : Complex_Vector) return Complex_Vector;

   function "*"
     (Left  : Complex_Matrix;
      Right : Real_Vector) return Complex_Vector;

   --  Complex_Matrix scaling operations

   function "*"
     (Left  : Complex;
      Right : Complex_Matrix) return  Complex_Matrix;

   function "*"
     (Left  : Complex_Matrix;
      Right : Complex) return Complex_Matrix;

   function "/"
     (Left  : Complex_Matrix;
      Right : Complex) return Complex_Matrix;

   function "*"
     (Left  : Real'Base;
      Right : Complex_Matrix) return Complex_Matrix;

   function "*"
     (Left  : Complex_Matrix;
      Right : Real'Base) return Complex_Matrix;

   function "/"
     (Left  : Complex_Matrix;
      Right : Real'Base) return Complex_Matrix;

   --  Complex_Matrix inversion and related operations

   function Solve
     (A : Complex_Matrix;
      X : Complex_Vector) return Complex_Vector;

   function Solve (A, X : Complex_Matrix) return Complex_Matrix;

   function Inverse (A : Complex_Matrix) return Complex_Matrix;

   function Determinant (A : Complex_Matrix) return Complex;

   --  Eigenvalues and vectors of a Hermitian matrix

   function Eigenvalues (A : Complex_Matrix) return Real_Vector;

   procedure Eigensystem
     (A       : Complex_Matrix;
      Values  : out Real_Vector;
      Vectors : out Complex_Matrix);

   --  Other Complex_Matrix operations

   function Unit_Matrix
     (Order            : Positive;
      First_1, First_2 : Integer := 1) return Complex_Matrix;

end Ada.Numerics.Generic_Complex_Arrays;