1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME COMPONENTS --
5 -- ADA.NUMERICS.GENERIC_COMPLEX_ARRAYS --
9 -- This specification is derived from the Ada Reference Manual for use with --
10 -- GNAT. In accordance with the copyright of that document, you can freely --
11 -- copy and modify this specification, provided that if you redistribute a --
12 -- modified version, any changes that you have made are clearly indicated. --
14 ------------------------------------------------------------------------------
16 with Ada
.Numerics
.Generic_Real_Arrays
, Ada
.Numerics
.Generic_Complex_Types
;
19 with package Real_Arrays
is new Ada
.Numerics
.Generic_Real_Arrays
(<>);
21 with package Complex_Types
is new Ada
.Numerics
.Generic_Complex_Types
(Real
);
23 package Ada
.Numerics
.Generic_Complex_Arrays
is
24 pragma Pure
(Generic_Complex_Arrays
);
28 type Complex_Vector
is array (Integer range <>) of Complex
;
29 type Complex_Matrix
is
30 array (Integer range <>, Integer range <>) of Complex
;
32 -- Subprograms for Complex_Vector types
33 -- Complex_Vector selection, conversion and composition operations
35 function Re
(X
: Complex_Vector
) return Real_Vector
;
36 function Im
(X
: Complex_Vector
) return Real_Vector
;
38 procedure Set_Re
(X
: in out Complex_Vector
; Re
: Real_Vector
);
39 procedure Set_Im
(X
: in out Complex_Vector
; Im
: Real_Vector
);
41 function Compose_From_Cartesian
42 (Re
: Real_Vector
) return Complex_Vector
;
43 function Compose_From_Cartesian
44 (Re
, Im
: Real_Vector
) return Complex_Vector
;
46 function Modulus
(X
: Complex_Vector
) return Real_Vector
;
47 function "abs" (Right
: Complex_Vector
) return Real_Vector
renames Modulus
;
48 function Argument
(X
: Complex_Vector
) return Real_Vector
;
52 Cycle
: Real
'Base) return Real_Vector
;
54 function Compose_From_Polar
55 (Modulus
, Argument
: Real_Vector
) return Complex_Vector
;
57 function Compose_From_Polar
58 (Modulus
, Argument
: Real_Vector
;
59 Cycle
: Real
'Base) return Complex_Vector
;
61 -- Complex_Vector arithmetic operations
63 function "+" (Right
: Complex_Vector
) return Complex_Vector
;
64 function "-" (Right
: Complex_Vector
) return Complex_Vector
;
65 function Conjugate
(X
: Complex_Vector
) return Complex_Vector
;
66 function "+" (Left
, Right
: Complex_Vector
) return Complex_Vector
;
67 function "-" (Left
, Right
: Complex_Vector
) return Complex_Vector
;
68 function "*" (Left
, Right
: Complex_Vector
) return Complex
;
69 function "abs" (Right
: Complex_Vector
) return Real
'Base;
71 -- Mixed Real_Vector and Complex_Vector arithmetic operations
75 Right
: Complex_Vector
) return Complex_Vector
;
78 (Left
: Complex_Vector
;
79 Right
: Real_Vector
) return Complex_Vector
;
83 Right
: Complex_Vector
) return Complex_Vector
;
86 (Left
: Complex_Vector
;
87 Right
: Real_Vector
) return Complex_Vector
;
89 function "*" (Left
: Real_Vector
; Right
: Complex_Vector
) return Complex
;
90 function "*" (Left
: Complex_Vector
; Right
: Real_Vector
) return Complex
;
92 -- Complex_Vector scaling operations
96 Right
: Complex_Vector
) return Complex_Vector
;
99 (Left
: Complex_Vector
;
100 Right
: Complex
) return Complex_Vector
;
103 (Left
: Complex_Vector
;
104 Right
: Complex
) return Complex_Vector
;
108 Right
: Complex_Vector
) return Complex_Vector
;
111 (Left
: Complex_Vector
;
112 Right
: Real
'Base) return Complex_Vector
;
115 (Left
: Complex_Vector
;
116 Right
: Real
'Base) return Complex_Vector
;
118 -- Other Complex_Vector operations
123 First
: Integer := 1) return Complex_Vector
;
125 -- Subprograms for Complex_Matrix types
127 -- Complex_Matrix selection, conversion and composition operations
129 function Re
(X
: Complex_Matrix
) return Real_Matrix
;
130 function Im
(X
: Complex_Matrix
) return Real_Matrix
;
132 procedure Set_Re
(X
: in out Complex_Matrix
; Re
: Real_Matrix
);
133 procedure Set_Im
(X
: in out Complex_Matrix
; Im
: Real_Matrix
);
135 function Compose_From_Cartesian
(Re
: Real_Matrix
) return Complex_Matrix
;
137 function Compose_From_Cartesian
138 (Re
, Im
: Real_Matrix
) return Complex_Matrix
;
140 function Modulus
(X
: Complex_Matrix
) return Real_Matrix
;
141 function "abs" (Right
: Complex_Matrix
) return Real_Matrix
renames Modulus
;
143 function Argument
(X
: Complex_Matrix
) return Real_Matrix
;
147 Cycle
: Real
'Base) return Real_Matrix
;
149 function Compose_From_Polar
150 (Modulus
, Argument
: Real_Matrix
) return Complex_Matrix
;
152 function Compose_From_Polar
153 (Modulus
: Real_Matrix
;
154 Argument
: Real_Matrix
;
155 Cycle
: Real
'Base) return Complex_Matrix
;
157 -- Complex_Matrix arithmetic operations
159 function "+" (Right
: Complex_Matrix
) return Complex_Matrix
;
160 function "-" (Right
: Complex_Matrix
) return Complex_Matrix
;
162 function Conjugate
(X
: Complex_Matrix
) return Complex_Matrix
;
163 function Transpose
(X
: Complex_Matrix
) return Complex_Matrix
;
165 function "+" (Left
, Right
: Complex_Matrix
) return Complex_Matrix
;
166 function "-" (Left
, Right
: Complex_Matrix
) return Complex_Matrix
;
167 function "*" (Left
, Right
: Complex_Matrix
) return Complex_Matrix
;
168 function "*" (Left
, Right
: Complex_Vector
) return Complex_Matrix
;
171 (Left
: Complex_Vector
;
172 Right
: Complex_Matrix
) return Complex_Vector
;
175 (Left
: Complex_Matrix
;
176 Right
: Complex_Vector
) return Complex_Vector
;
178 -- Mixed Real_Matrix and Complex_Matrix arithmetic operations
182 Right
: Complex_Matrix
) return Complex_Matrix
;
185 (Left
: Complex_Matrix
;
186 Right
: Real_Matrix
) return Complex_Matrix
;
190 Right
: Complex_Matrix
) return Complex_Matrix
;
193 (Left
: Complex_Matrix
;
194 Right
: Real_Matrix
) return Complex_Matrix
;
198 Right
: Complex_Matrix
) return Complex_Matrix
;
201 (Left
: Complex_Matrix
;
202 Right
: Real_Matrix
) return Complex_Matrix
;
206 Right
: Complex_Vector
) return Complex_Matrix
;
209 (Left
: Complex_Vector
;
210 Right
: Real_Vector
) return Complex_Matrix
;
214 Right
: Complex_Matrix
) return Complex_Vector
;
217 (Left
: Complex_Vector
;
218 Right
: Real_Matrix
) return Complex_Vector
;
222 Right
: Complex_Vector
) return Complex_Vector
;
225 (Left
: Complex_Matrix
;
226 Right
: Real_Vector
) return Complex_Vector
;
228 -- Complex_Matrix scaling operations
232 Right
: Complex_Matrix
) return Complex_Matrix
;
235 (Left
: Complex_Matrix
;
236 Right
: Complex
) return Complex_Matrix
;
239 (Left
: Complex_Matrix
;
240 Right
: Complex
) return Complex_Matrix
;
244 Right
: Complex_Matrix
) return Complex_Matrix
;
247 (Left
: Complex_Matrix
;
248 Right
: Real
'Base) return Complex_Matrix
;
251 (Left
: Complex_Matrix
;
252 Right
: Real
'Base) return Complex_Matrix
;
254 -- Complex_Matrix inversion and related operations
258 X
: Complex_Vector
) return Complex_Vector
;
260 function Solve
(A
, X
: Complex_Matrix
) return Complex_Matrix
;
262 function Inverse
(A
: Complex_Matrix
) return Complex_Matrix
;
264 function Determinant
(A
: Complex_Matrix
) return Complex
;
266 -- Eigenvalues and vectors of a Hermitian matrix
268 function Eigenvalues
(A
: Complex_Matrix
) return Real_Vector
;
270 procedure Eigensystem
272 Values
: out Real_Vector
;
273 Vectors
: out Complex_Matrix
);
275 -- Other Complex_Matrix operations
279 First_1
, First_2
: Integer := 1) return Complex_Matrix
;
281 end Ada
.Numerics
.Generic_Complex_Arrays
;